touch state: fix conversion for multitouch widgets

This commit is contained in:
bordun 2020-10-02 10:42:40 +02:00
parent ff29752a49
commit 4c83badea2
2 changed files with 7 additions and 7 deletions

View file

@ -34,15 +34,15 @@ When some widgets are touched or released, a special event can be catched to tri
If the variable `touch` is not `undefined`, this means it holds the widget's cuurent touch state:
- `0/1` if the widget is single touch (`fader`, `knob` and `xy`)
- `0/1` for the widget's touch state (`fader`, `knob` and `xy`, `range` and `multixy`)
- `[i, 0/1]` if the widget is multi touch (`range` and `multixy`). In this case `i` is the touched handle's index, starting with `0`.
Example script:
```js
if (touch !== undefined) {
// send touch state
send('/touch_address', touch)
// send multi touch state
if (touch.length) send('/touch_address', touch[0], touch[1])
// send global touch state
else send('/touch_address', touch)
} else {
// do something with the value ?
}