osc: unpack 1-item and 0-item array args to route them correctly
fixes push/toggles not recognizing 0-item / no arg correspondinf to special "null" value
This commit is contained in:
parent
413defbfa8
commit
8483e87c30
1 changed files with 6 additions and 2 deletions
|
|
@ -15,17 +15,21 @@ module.exports = {
|
|||
|
||||
if (typeof data.args == 'object') {
|
||||
for (var i=data.args.length-1;i>=0;i--) {
|
||||
var ref = data.args.length>1?path+'||||'+data.args.slice(0,i).join('||||'):data.path
|
||||
var ref = path+'||||'+data.args.slice(0,i).join('||||')
|
||||
if (WIDGETS_BY_PATH[ref]) {
|
||||
pathref = ref
|
||||
args = data.args.slice(i,data.args.length)
|
||||
args = args.length==1?args[0]:args
|
||||
continue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
args = data.args
|
||||
}
|
||||
|
||||
|
||||
if (args.length==0) args = null
|
||||
else if (args.length==1) args = args[0]
|
||||
|
||||
for (i in WIDGETS_BY_PATH[pathref]) {
|
||||
if (WIDGETS_BY_PATH[pathref][i]) WIDGETS_BY_PATH[pathref][i].setValue(args,false,true)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue