script: set: affect only 1 widget if no wildcard is used
This commit is contained in:
parent
f78abcc674
commit
03e810ad2a
2 changed files with 4 additions and 3 deletions
|
|
@ -63,13 +63,14 @@ Returns the value of the first matching widget.
|
|||
----
|
||||
|
||||
#### `set(id, value, options)`
|
||||
- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. `id` can contains wildcards ('\*'), in which case all matching widgets will be affected **except** the emitting widget.
|
||||
- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. `id` may contains wildcards ('\*').
|
||||
- `value`: new value for the widget.
|
||||
- `options` (optional): `object`, accepts the following items:
|
||||
- `sync: false` (prevents widgets from triggering synchronization and scripts)
|
||||
- `send: false` (prevents widgets from sending osc messages)
|
||||
|
||||
Sets the value of matching widgets.
|
||||
Sets the value of the first matching widget or, if `ìd` contains wildcards, affects all matching widgets **except** the emitting widget.
|
||||
|
||||
If the event that triggered the script's execution was initiated by a user interaction, this will make the widget send its value as well (unless `options` is set to `{send: false}`).
|
||||
|
||||
----
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class ScriptVm extends Vm {
|
|||
Object.keys(widgetManager.idRoute).filter(key => key.match(new RegExp('^' + id.replace(/\*/g, '.*') + '$')))
|
||||
).filter(w => w !== widget)
|
||||
} else {
|
||||
widgets = this.resolveId(id)
|
||||
widgets = this.resolveId(id).slice(0, 1)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue