store multiples ids vs osc path to update all corresponding widgets
This commit is contained in:
parent
cf159d3d93
commit
1eba6b683a
2 changed files with 13 additions and 9 deletions
|
|
@ -8,17 +8,21 @@ module.exports = {
|
|||
receiveOsc: function(event,data){
|
||||
var data = data || event
|
||||
|
||||
// fetch id
|
||||
// fetch ids corresponding to the osc path
|
||||
var path = data.path
|
||||
var id = WIDGETS_ID_BY_PATH[path]
|
||||
|
||||
// update
|
||||
if (WIDGETS[id]!=undefined) {
|
||||
for (i in WIDGETS[id]){
|
||||
WIDGETS[id][i].setValue(data.args,false,true)
|
||||
var ids = WIDGETS_ID_BY_PATH[path]
|
||||
|
||||
for (i in ids) {
|
||||
var id = ids[i]
|
||||
// update
|
||||
if (WIDGETS[id]) {
|
||||
for (j in WIDGETS[id]){
|
||||
WIDGETS[id][j].setValue(data.args,false,true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
stateLoad: function(event,data){
|
||||
|
|
|
|||
|
|
@ -160,9 +160,9 @@ module.exports.widgets = function(data,parent) {
|
|||
WIDGETS_LINKED[widgetData.linkId].push(widgetInner)
|
||||
}
|
||||
|
||||
|
||||
// store path vs widget id for faster cross-app sync
|
||||
WIDGETS_ID_BY_PATH[widgetData.path] = widgetData.id
|
||||
if (WIDGETS_ID_BY_PATH[widgetData.path]==undefined) WIDGETS_ID_BY_PATH[widgetData.path] = []
|
||||
WIDGETS_ID_BY_PATH[widgetData.path].push(widgetData.id)
|
||||
|
||||
parent.append(widgetContainer)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue