launcher ok

This commit is contained in:
bordun 2020-03-11 16:42:45 +01:00
parent a8fee9c5c3
commit 97c504e79a
23 changed files with 220 additions and 89 deletions

View file

@ -28,6 +28,7 @@ class Toast {
if (this.html) {
this.html = morph(this.html, toast)
this.html.style.height = this.html.offsetHeight + 'px'
} else {
this.html = toast
}

View file

@ -1,12 +1,24 @@
var html = require('nanohtml'),
UiModal = require('./ui-modal')
UiModal = require('./ui-modal'),
notifications = require('./notifications'),
loading = null, timeout = null
module.exports = function uiLoading(title) {
return new UiModal({
title: title,
content: html`<p><div class="spinner"></div></p>`,
closable: false
})
if (title === false && loading) {
clearTimeout(timeout)
timeout = setTimeout(()=>{
console.log('stop')
notifications.remove(loading)
loading = null
}, 500)
} else if (title !== false) {
notifications.add({
id: 'LOADING',
icon: 'spinner fa-spin',
message: title
})
loading = notifications.toasts[notifications.toasts.length - 1]
}
}

View file

@ -8,8 +8,8 @@ class UiSidePanel extends UiWidget {
if (options.label) DOM.get(this.container, 'osc-panel-header')[0].textContent = options.label
this.vertical = this.container.classList.contains('bottom') || this.container.classList.contains('tpop')
this.resizeDirection = this.container.classList.contains('left') ? 1 : -1
this.vertical = this.container.classList.contains('bottom') || this.container.classList.contains('top')
this.resizeDirection = this.container.classList.contains('left') || this.container.classList.contains('top') ? 1 : -1
this.resizeHandle = DOM.get(this.container, '.resize-handle')[0]
this.toggleButton = DOM.get(this.container, '.toggle-button')[0]
this.content = DOM.get(this.container, 'osc-panel-content')[0]
@ -21,6 +21,13 @@ class UiSidePanel extends UiWidget {
this.minimized = false
this.init = false
this.on('draginit', (event)=>{
this.width = parseInt(this.container[this.vertical ? 'offsetHeight' : 'offsetWidth']) / PXSCALE
}, {element: this.resizeHandle})
this.on('drag', (event)=>{
this.width += this.resizeDirection * event[this.vertical ? 'movementY' : 'movementX'] / PXSCALE