buttons: fix broken null & remove switch old animation code
This commit is contained in:
parent
80f21e6e7e
commit
c043b6145d
4 changed files with 12 additions and 14 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue