norelease toggle doesn't sync anymore

This commit is contained in:
bordun 2020-03-06 17:18:53 +01:00
parent 07b67f10d2
commit 05594ca878
3 changed files with 12 additions and 3 deletions

View file

@ -69,6 +69,9 @@ class Toggle extends Widget {
this.active = true
this.setValue(this.getProp('on'), {sync: true, send: true})
if (tap) this.container.classList.add('active')
}, {element: this.widget})
}
@ -78,7 +81,9 @@ class Toggle extends Widget {
if (!this.active) return
this.active = false
this.setValue(this.getProp('off'), {sync: true, send: !tap})
if (!tap) this.setValue(this.getProp('off'), {sync: true, send: true})
if (tap) this.container.classList.remove('active')
}, {element: this.widget})
@ -151,6 +156,10 @@ class Toggle extends Widget {
if (options.send) this.sendValue()
if (options.sync) this.changed(options)
if (newstate && this.getProp('mode') === 'tap') {
this.setValue(this.getProp('off'), {sync: false, send: false})
}
}

View file

@ -30,7 +30,7 @@ class Root extends StaticProperties(Panel, {scroll: false, label: false, id: 'ro
}, [
'label',
'_geometry', 'left', 'top', 'width', 'height',
'_geometry', 'left', 'top', 'width', 'height', 'expand',
'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOff',
], {

View file

@ -37,7 +37,7 @@
}
&.on {
&.on, &.active {
--alpha-fill:var(--alpha-fill-on);