diff --git a/src/client/widgets/buttons/toggle.js b/src/client/widgets/buttons/toggle.js index c6324e25..2ccab3a0 100644 --- a/src/client/widgets/buttons/toggle.js +++ b/src/client/widgets/buttons/toggle.js @@ -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}) + } + } diff --git a/src/client/widgets/containers/root.js b/src/client/widgets/containers/root.js index 0ff173a1..78167da0 100644 --- a/src/client/widgets/containers/root.js +++ b/src/client/widgets/containers/root.js @@ -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', ], { diff --git a/src/scss/widgets/buttons.scss b/src/scss/widgets/buttons.scss index d181d16b..a1e436db 100644 --- a/src/scss/widgets/buttons.scss +++ b/src/scss/widgets/buttons.scss @@ -37,7 +37,7 @@ } - &.on { + &.on, &.active { --alpha-fill:var(--alpha-fill-on);