widgets: tell widgets if osc messages come from local feedback (from another client)
This commit is contained in:
parent
c34d2e93c1
commit
f35cfbb3a6
6 changed files with 12 additions and 8 deletions
|
|
@ -37,7 +37,7 @@ module.exports = {
|
|||
// compare arrays using > and < operators (both false = equality)
|
||||
if (!target || !(WIDGETS_BY_PATH[pathref][i].target < target || WIDGETS_BY_PATH[pathref][i].target > target)) {
|
||||
// update matching widgets
|
||||
if (WIDGETS_BY_PATH[pathref][i]) WIDGETS_BY_PATH[pathref][i].setValue(args,{send:false,sync:true})
|
||||
if (WIDGETS_BY_PATH[pathref][i]) WIDGETS_BY_PATH[pathref][i].setValue(args,{send:false,sync:true,fromLocal:target})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ module.exports.sync = function() {
|
|||
var v = widget.getValue()
|
||||
for (i in WIDGETS[id]) {
|
||||
if (!WIDGETS[id][i].is(widget) && WIDGETS[id][i].setValue) {
|
||||
WIDGETS[id][i].setValue(v)
|
||||
WIDGETS[id][i].setValue(v,{fromLocal:true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ module.exports.sync = function() {
|
|||
var v = widget.getValue()
|
||||
for (i in WIDGETS_LINKED[linkId]) {
|
||||
if (!WIDGETS_LINKED[linkId][i].is(widget) && WIDGETS_LINKED[linkId][i].setValue) {
|
||||
WIDGETS_LINKED[linkId][i].setValue(v,{send:true,sync:true})
|
||||
WIDGETS_LINKED[linkId][i].setValue(v,{send:true,sync:false,fromLocal:true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,10 @@ module.exports.create = function(widgetData,container) {
|
|||
}
|
||||
|
||||
widget.setValue = function(v,options={}) {
|
||||
if (options.fromLocal) {
|
||||
widget.setValuePrivate(v,options.send,false)
|
||||
return
|
||||
}
|
||||
if (v===widgetData.on || (v=='false'&&widgetData.on===false)) {
|
||||
widget.addClass('on')
|
||||
widget.state = 1
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ _sliders_base.prototype.setValue = function(v,options={}) {
|
|||
|
||||
var value = roundTo(clip(Math.round(v*this.roundFactor)/this.roundFactor,[this.rangeValsMin,this.rangeValsMax]),this.widgetData.precision)
|
||||
|
||||
if (options.dragged && this.value == value) send = false
|
||||
if ((options.dragged || options.fromLocal) && this.value == value) options.send = false
|
||||
|
||||
this.value = value
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ Fader.prototype.draginitHandle = function(e, data, traversing){
|
|||
|
||||
// this.percent = clip(this.percent,[0,100])
|
||||
|
||||
this.setValue(this.percentToValue(this.percent), true, true, true)
|
||||
this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true})
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ Fader.prototype.dragHandle = function(e, data) {
|
|||
this.percent + ( data.speedX/(this.width - this.margin * PXSCALE * 2)) * 100:
|
||||
this.percent + (-data.speedY/(this.height - this.margin * PXSCALE * 2)) * 100
|
||||
|
||||
this.setValue(this.percentToValue(this.percent), true, true, true)
|
||||
this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ Knob.prototype.draginitHandle = function(e, data, traversing){
|
|||
|
||||
this.percent = this.angleToPercent(this.coordsToAngle(data.offsetX, data.offsetY))
|
||||
|
||||
this.setValue(this.percentToValue(this.percent), true, true, true)
|
||||
this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true})
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ Knob.prototype.dragHandle = function(e, data, traversing) {
|
|||
|
||||
this.percent = this.percent,[0,100]
|
||||
|
||||
this.setValue(this.percentToValue(this.percent), true, true, true)
|
||||
this.setValue(this.percentToValue(this.percent), {send:true,sync:true,dragged:true})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue