osc: check osc self-linked props before sending and document what it breaks

This commit is contained in:
jean-emmanuel 2018-03-16 19:21:36 +01:00
parent be36306887
commit fea519c0d7
3 changed files with 19 additions and 0 deletions

View file

@ -8,6 +8,7 @@
- modal: prevent touch event from affecting elements behind the popup when closing it
- clone: some properies in target widget were not applied to the clone
- text: vertical centering issues in narrow widgets
- dynamic properties: when using a widget's own value to determine its osc settings, these are checked and updated if needed before sending the message
- editor
- wrap in: insert wrapper at selected widget's index
- wrap in: set label to false by default when wrapping in a strip or a panel

View file

@ -137,3 +137,6 @@ preArgs: [
- type: `boolean`
- default: `false`
- usage: set to `true` to prevent the widget from sending any osc message
!!! note ""
Changing OSC properties dynamically using advanced property syntax is likely to break synchronisation between multiple clients.

View file

@ -10,6 +10,14 @@ var EventEmitter = require('../../events/event-emitter'),
updateWidget = ()=>{}
var OSCProps = [
'precision',
'address',
'preArgs',
'target',
'bypass'
]
var fallbackContainer
DOM.ready(()=>{
@ -116,6 +124,9 @@ class Widget extends EventEmitter {
}
var selfLinkedOSCProps = (this.linkedPropsValue['this'] || []).filter(i => OSCProps.indexOf(i) > -1)
this.selfLinkedOSCProps = selfLinkedOSCProps.length ? selfLinkedOSCProps : false
// cache precision
if (this.props.precision != undefined) {
this.precision = Math.min(20,Math.max(this.getProp('precision', undefined, false),0))
@ -180,6 +191,10 @@ class Widget extends EventEmitter {
sendValue(overrides, options={}) {
if (this.selfLinkedOSCProps) {
this.updateProps(this.selfLinkedOSCProps, this)
}
if (this.getProp('bypass') && !options.force) return
var data = {