osc: make widgets without target always receive messages

This commit is contained in:
jean-emmanuel 2017-10-12 18:54:50 +02:00
parent affc6c7a14
commit a299c971a0

View file

@ -67,10 +67,11 @@ Osc.prototype.receive = function(data){
let widget = widgetManager.getWidgetByAddress(addressref)
for (let i in widget) {
let widgetTarget = widget[i].getProp('target')
// if the message target is provided (when message comes from another client connected to the same server)
// then we only update the widgets that have the same target
// compare arrays using > and < operators (both false = equality)
if (!target || !(widget[i].getProp('target') < target || widget[i].getProp('target') > target || (widget[i].getProp('target') && widget[i].getProp('target').length !== target.length))) {
if (!target || !widgetTarget || !(widgetTarget < target || widgetTarget > target || (widgetTarget.length !== target.length))) {
// update matching widgets
if (widget[i] && widget[i].setValue) widget[i].setValue(args,{send:false,sync:true,fromExternal:!target})
}