From a8ab78e071ad56b6493a066304c0a83c3db8563e Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 23 Feb 2016 12:52:01 +0100 Subject: [PATCH] Add linkId for widget linking (=state sync + osc send) (#5) (also fixed some quirks with toggle/push) --- app/browser/js/app/init.js | 31 ++++++++++++++++++++++++------- app/browser/js/app/parser.js | 15 ++++++++++----- app/browser/js/app/widgets.js | 18 +++++++++++++----- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/app/browser/js/app/init.js b/app/browser/js/app/init.js index 0e1cb92f..98bddeeb 100644 --- a/app/browser/js/app/init.js +++ b/app/browser/js/app/init.js @@ -92,12 +92,12 @@ init = function(session,callback) { } sidepanel() - // Widget Synchronization : widget that share the same id will update each other - // without sending any extra osc message + // Widget Synchronization sync = function() { + // Widget that share the same id will update each other + // without sending any extra osc message $.each(__widgets__,function(i,widget) { if (widget.length>1) { - var closureSync = function(x) { return function() { var v = widget[x].getValue() @@ -109,12 +109,29 @@ init = function(session,callback) { } } } - for (j in widget) { - widget[j].off('sync').on('sync',closureSync(j)) + widget[j].off('sync.id').on('sync.id',closureSync(j)) + } + } + }) + // widgets that share the same linkId will update each other. + // Updated widgets will send osc messages normally + $.each(__widgetsLinks__,function(i,widget) { + if (widget.length>1) { + var closureSync = function(x) { + return function() { + var v = widget[x].getValue() + for (k=0;k