widgets: implement ignoreDefaults property and remove support for null/self tokens in target

This commit is contained in:
bordun 2020-04-17 18:41:59 +02:00
parent 2f72768344
commit 517e089773
3 changed files with 6 additions and 4 deletions

View file

@ -36,6 +36,8 @@
- widget changes
- all: removed support for `null` and `"self"` targets
- all: added `ignoreDefaults` property (allows ignoring the server's default targets)
- all: `precision` property to `decimals`, don't set osc integer typetag when 0
- all: added `typeTags` property
- all: multiple style properties to control visibility, colors, alphas and padding

View file

@ -124,9 +124,7 @@ class Widget extends EventEmitter {
'This defines the targets of the widget\'s OSC messages',
'- A `string` or `array` of strings formatted as follow: `ip:port` or `["ip:port"]`',
'- If midi is enabled, targets can be `midi:device_name`',
'- The special item `"self"` can be used to refer to the emitting client directly.',
'- If no target is set, messages can still be sent if the server has default targets',
'- The server\'s default targets can be bypassed by setting one of the items to `null`'
]},
ignoreDefaults: {type: 'boolean', value: false, help: 'Set to `true` to ignore the server\'s default targets'},
bypass: {type: 'boolean', value: false, help: 'Set to `true` to prevent the widget from sending any osc message'}
@ -286,9 +284,11 @@ class Widget extends EventEmitter {
var data = {
h: this.hash,
v: this.getValue(true)
v: this.getValue(true),
}
if (this.getProp('ignoreDefaults')) data.i = 1
if (overrides) {
for (var k in overrides) {
data[k] = overrides[k]

View file

@ -319,7 +319,7 @@ module.exports = {
var targets = []
if (data.target.indexOf(null) === -1 && settings.read('send') && !shortdata.target) Array.prototype.push.apply(targets, settings.read('send'))
if (shortdata.i && settings.read('send') && !shortdata.target) Array.prototype.push.apply(targets, settings.read('send'))
if (data.target) Array.prototype.push.apply(targets, data.target)
data.args = data.preArgs ? data.preArgs.concat(value) : [value]