diff --git a/CHANGELOG.md b/CHANGELOG.md index ade247d2..376ca2f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,11 @@ ## next +- bug fixes + - `push` widgets (and `keyboards`) not correctly synchronizing each other (with shared widget ids or between different clients) - widgets - `css` option now supports css selectors, scoped to the widgets element - - `matrices` don't pass `css` option to their children anymore; subwidgets' indexes are now append to `preArgs` instead of being prepended. + - `matrices` don't pass `css` option to their children anymore; subwidgets' indexes are now append to `preArgs` instead of being prepended. - misc - app's title uppercased - tabs titles' letter-spacing increased diff --git a/src/browser/js/app/widgets/buttons/push.js b/src/browser/js/app/widgets/buttons/push.js index 0540d6ed..8265f77a 100644 --- a/src/browser/js/app/widgets/buttons/push.js +++ b/src/browser/js/app/widgets/buttons/push.js @@ -80,14 +80,15 @@ module.exports = class Push extends _widgets_base { setValuePrivate(v,options={}) { - if (v===this.widgetData.on || (this.widgetData.on != null && v.value === this.widgetData.on.value && v.value !== undefined)) { + if (typeof v == 'object' && v !== null) v = v.value + if (v===this.widgetData.on || (this.widgetData.on != null && v === this.widgetData.on.value && v !== undefined)) { this.widget.addClass('active') this.active = 1 this.lastChanged = 'active' this.updateValue() if (options.send) this.sendValue(v) if (options.sync) this.widget.trigger({type:'sync',id:this.widgetData.id,widget:this.widget, linkId:this.widgetData.linkId, options:options}) - } else if (v===this.widgetData.off || (this.widgetData.off != null && v.value === this.widgetData.off.value && v.value !== undefined)) { + } else if (v===this.widgetData.off || (this.widgetData.off != null && v === this.widgetData.off.value && v !== undefined)) { this.widget.removeClass('active') this.active = 0 this.lastChanged = 'active' @@ -101,16 +102,17 @@ module.exports = class Push extends _widgets_base { setValue(v,options={}) { if (!options.fromExternal) { - if (options.send || options.sync) this.setValuePrivate(v,options) + this.setValuePrivate(v,options) return } - if (v===this.widgetData.on || (this.widgetData.on != null && v.value === this.widgetData.on.value && v.value !== undefined)) { + if (typeof v == 'object' && v !== null) v = v.value + if (v===this.widgetData.on || (this.widgetData.on != null && v === this.widgetData.on.value && v !== undefined)) { this.widget.addClass('on') this.state = 1 if (options.send) this.sendValue(v) this.lastChanged = 'state' if (options.sync) this.widget.trigger({type:'sync',id:this.widgetData.id,widget:this.widget, linkId:this.widgetData.linkId,options:options}) - } else if (v===this.widgetData.off || (this.widgetData.off != null && v.value === this.widgetData.off.value && v.value !== undefined)) { + } else if (v===this.widgetData.off || (this.widgetData.off != null && v === this.widgetData.off.value && v !== undefined)) { this.widget.removeClass('on') this.state = 0 if (options.send) this.sendValue(v)