diff --git a/CHANGELOG.md b/CHANGELOG.md index 0655d21d..9c0841c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - bug - avoid crash when sending osc with incorrect typetags - fixed fallback typetag ('s') + - fixed broken `null` value for `push` & `toggle` ## 0.8.1 diff --git a/src/browser/js/app/widgets/push.js b/src/browser/js/app/widgets/push.js index 275cf60d..a3c325fb 100644 --- a/src/browser/js/app/widgets/push.js +++ b/src/browser/js/app/widgets/push.js @@ -59,19 +59,19 @@ module.exports.create = function(widgetData,container) { widget.getValue = function() { return widget[widget.lastChanged] ? - widgetData.on.value !== undefined ? widgetData.on.value : widgetData.on + widgetData.on != null && widgetData.on.value !== undefined ? widgetData.on.value : widgetData.on : - widgetData.off.value !== undefined ? widgetData.off.value : widgetData.off + widgetData.off != null && widgetData.off.value !== undefined ? widgetData.off.value : widgetData.off } widget.setValuePrivate = function(v,options={}) { - if (v===widgetData.on || (v.value === widgetData.on.value && v.value !== undefined)) { + if (v===widgetData.on || (widgetData.on != null && v.value === widgetData.on.value && v.value !== undefined)) { widget.addClass('active') widget.active = 1 if (options.send) widget.sendValue(v) widget.lastChanged = 'active' if (options.sync) widget.trigger({type:'sync',id:widgetData.id,widget:widget, linkId:widgetData.linkId, options:options}) - } else if (v===widgetData.off || (v.value === widgetData.off.value && v.value !== undefined)) { + } else if (v===widgetData.off || (widgetData.off != null && v.value === widgetData.off.value && v.value !== undefined)) { widget.removeClass('active') widget.active = 0 if (options.send) widget.sendValue(v, widgetData.norelease) @@ -85,13 +85,13 @@ module.exports.create = function(widgetData,container) { if (options.send || options.sync) widget.setValuePrivate(v,options) return } - if (v===widgetData.on || (v.value === widgetData.on.value && v.value !== undefined)) { + if (v===widgetData.on || (widgetData.on != null && v.value === widgetData.on.value && v.value !== undefined)) { widget.addClass('on') widget.state = 1 if (options.send) widget.sendValue(v) widget.lastChanged = 'state' if (options.sync) widget.trigger({type:'sync',id:widgetData.id,widget:widget, linkId:widgetData.linkId,options:options}) - } else if (v===widgetData.off || (v.value === widgetData.off.value && v.value !== undefined)) { + } else if (v===widgetData.off || (widgetData.off != null && v.value === widgetData.off.value && v.value !== undefined)) { widget.removeClass('on') widget.state = 0 if (options.send) widget.sendValue(v) diff --git a/src/browser/js/app/widgets/switch.js b/src/browser/js/app/widgets/switch.js index 5710ce9c..856c8862 100644 --- a/src/browser/js/app/widgets/switch.js +++ b/src/browser/js/app/widgets/switch.js @@ -60,10 +60,7 @@ module.exports.create = function(widgetData,container) { if (i!=-1) { widget.value = widget.values[i] widget.find('.on').removeClass('on') - widget.find('.value').eq(i).addClass('on').removeClass('ripple').addClass('ripple').delay(250).queue(function(next){ - $(this).removeClass('ripple') - next() - }) + widget.find('.value').eq(i).addClass('on') if (options.send) widget.sendValue(widget.value) if (options.sync) widget.trigger({type:'sync',id:widgetData.id,widget:widget, linkId:widgetData.linkId, options}) } diff --git a/src/browser/js/app/widgets/toggle.js b/src/browser/js/app/widgets/toggle.js index ee1d31a6..c8ceb888 100644 --- a/src/browser/js/app/widgets/toggle.js +++ b/src/browser/js/app/widgets/toggle.js @@ -56,16 +56,16 @@ module.exports.create = function(widgetData,container) { widget.getValue = function() { return widget.state ? - widgetData.on.value !== undefined ? widgetData.on.value : widgetData.on + widgetData.on != null && widgetData.on.value !== undefined ? widgetData.on.value : widgetData.on : - widgetData.off.value !== undefined ? widgetData.off.value : widgetData.off + widgetData.off != null && widgetData.off.value !== undefined ? widgetData.off.value : widgetData.off } widget.setValue = function(v,options={}) { - if (v===widgetData.on || (v.value === widgetData.on.value && v.value !== undefined)) { + if (v===widgetData.on || (widgetData.on != null && v.value === widgetData.on.value && v.value !== undefined)) { widget.addClass('on') widget.state = 1 if (options.send) widget.sendValue(widgetData.on) - } else if (v===widgetData.off || (v.value === widgetData.off.value && v.value !== undefined)) { + } else if (v===widgetData.off || (widgetData.off != null && v.value === widgetData.off.value && v.value !== undefined)) { widget.removeClass('on') widget.state = 0 if (options.send) widget.sendValue(widgetData.off)