scrpting: restore legacy touch state feature, deprecate it and replace with a more generic onTouch handler
This commit is contained in:
parent
d478de49f6
commit
24db0ed984
11 changed files with 147 additions and 65 deletions
|
|
@ -696,6 +696,7 @@
|
|||
| property | type |default | description |
|
||||
| --- | --- | --- | --- |
|
||||
| <h6 id="xy_onValue">onValue<a class="headerlink" href="#xy_onValue" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget's value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.<br/><br/>Canvas-based widget have their computed width and height available as local variables:<br/>- `locals.width`<br/>- `locals.height` |
|
||||
| <h6 id="xy_onTouch">onTouch<a class="headerlink" href="#xy_onTouch" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget is touched. See <a href="https://openstagecontrol.ammd.net/docs/widgets/canvas/">documentation</a>. |
|
||||
|
||||
??? api "<div id="rgb">rgb<a class="headerlink" href="#rgb" title="Permanent link">#</a></div>"
|
||||
Color picker with optional alpha slider.
|
||||
|
|
@ -710,6 +711,12 @@
|
|||
| <h6 id="rgb_alpha">alpha<a class="headerlink" href="#rgb_alpha" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable alpha channel |
|
||||
| <h6 id="rgb_rangeAlpha">rangeAlpha<a class="headerlink" href="#rgb_rangeAlpha" title="Permanent link">#</a></h6> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the widget's output scale for the alpha channel. |
|
||||
|
||||
=== "scripting"
|
||||
|
||||
| property | type |default | description |
|
||||
| --- | --- | --- | --- |
|
||||
| <h6 id="rgb_onTouch">onTouch<a class="headerlink" href="#rgb_onTouch" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget is touched. See <a href="https://openstagecontrol.ammd.net/docs/widgets/canvas/">documentation</a>. |
|
||||
|
||||
??? api "<div id="multixy">multixy<a class="headerlink" href="#multixy" title="Permanent link">#</a></div>"
|
||||
Multi-point XY pad.
|
||||
|
||||
|
|
@ -740,6 +747,7 @@
|
|||
| property | type |default | description |
|
||||
| --- | --- | --- | --- |
|
||||
| <h6 id="multixy_onValue">onValue<a class="headerlink" href="#multixy_onValue" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget's value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.<br/><br/>Canvas-based widget have their computed width and height available as local variables:<br/>- `locals.width`<br/>- `locals.height` |
|
||||
| <h6 id="multixy_onTouch">onTouch<a class="headerlink" href="#multixy_onTouch" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget is touched. See <a href="https://openstagecontrol.ammd.net/docs/widgets/canvas/">documentation</a>. |
|
||||
|
||||
??? api "<div id="canvas">canvas<a class="headerlink" href="#canvas" title="Permanent link">#</a></div>"
|
||||
Multitouch canvas widget with user-defined drawing functions and touch reactions.
|
||||
|
|
@ -800,6 +808,7 @@
|
|||
| property | type |default | description |
|
||||
| --- | --- | --- | --- |
|
||||
| <h6 id="fader_onValue">onValue<a class="headerlink" href="#fader_onValue" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget's value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.<br/><br/>Canvas-based widget have their computed width and height available as local variables:<br/>- `locals.width`<br/>- `locals.height` |
|
||||
| <h6 id="fader_onTouch">onTouch<a class="headerlink" href="#fader_onTouch" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget is touched. See <a href="https://openstagecontrol.ammd.net/docs/widgets/canvas/">documentation</a>. |
|
||||
|
||||
??? api "<div id="knob">knob<a class="headerlink" href="#knob" title="Permanent link">#</a></div>"
|
||||
Rotative knob slider.
|
||||
|
|
@ -832,6 +841,7 @@
|
|||
| property | type |default | description |
|
||||
| --- | --- | --- | --- |
|
||||
| <h6 id="knob_onValue">onValue<a class="headerlink" href="#knob_onValue" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget's value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.<br/><br/>Canvas-based widget have their computed width and height available as local variables:<br/>- `locals.width`<br/>- `locals.height` |
|
||||
| <h6 id="knob_onTouch">onTouch<a class="headerlink" href="#knob_onTouch" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget is touched. See <a href="https://openstagecontrol.ammd.net/docs/widgets/canvas/">documentation</a>. |
|
||||
|
||||
??? api "<div id="encoder">encoder<a class="headerlink" href="#encoder" title="Permanent link">#</a></div>"
|
||||
A knob that sends a relative direction infomation instead of an absolute value.
|
||||
|
|
@ -861,6 +871,7 @@
|
|||
| property | type |default | description |
|
||||
| --- | --- | --- | --- |
|
||||
| <h6 id="encoder_onValue">onValue<a class="headerlink" href="#encoder_onValue" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget's value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.<br/><br/>Canvas-based widget have their computed width and height available as local variables:<br/>- `locals.width`<br/>- `locals.height`<br/><br/>Additionnal variables:<br/>- `locals.speed`: encoder's speed (reduce `sensitivity` to increase averaging)<br/>- `locals.angle`: encoder's angle in degrees |
|
||||
| <h6 id="encoder_onTouch">onTouch<a class="headerlink" href="#encoder_onTouch" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget is touched. See <a href="https://openstagecontrol.ammd.net/docs/widgets/canvas/">documentation</a>. |
|
||||
|
||||
??? api "<div id="range">range<a class="headerlink" href="#range" title="Permanent link">#</a></div>"
|
||||
A fader with two heads for setting a range.
|
||||
|
|
@ -894,6 +905,7 @@
|
|||
| property | type |default | description |
|
||||
| --- | --- | --- | --- |
|
||||
| <h6 id="range_onValue">onValue<a class="headerlink" href="#range_onValue" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget's value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.<br/><br/>Canvas-based widget have their computed width and height available as local variables:<br/>- `locals.width`<br/>- `locals.height` |
|
||||
| <h6 id="range_onTouch">onTouch<a class="headerlink" href="#range_onTouch" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed when the widget is touched. See <a href="https://openstagecontrol.ammd.net/docs/widgets/canvas/">documentation</a>. |
|
||||
## Scripts
|
||||
|
||||
??? api "<div id="script">script<a class="headerlink" href="#script" title="Permanent link">#</a></div>"
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ The following variables are available in this context:
|
|||
value[getIndex(id)]
|
||||
```
|
||||
|
||||
??? infos "Touch state"
|
||||
??? infos "Touch state" (deprecated)
|
||||
|
||||
*This feature is deprecated, use `onTouch` instead*
|
||||
|
||||
When some widgets are touched or released, a special value event can be caught to trigger custom actions.
|
||||
|
||||
|
|
@ -47,11 +49,30 @@ The following variables are available in this context:
|
|||
}
|
||||
```
|
||||
|
||||
To avoid unwanted script executions, touch state events will only be caught if the script contains the word `touch`.
|
||||
To avoid unwanted script executions, touch state events will only be caught if the script contains the word `touch` and if `onTouch` is empty.
|
||||
|
||||
|
||||
### `onTouch`
|
||||
|
||||
This script is executed when the widget is touched, and when it is released.
|
||||
|
||||
This script has access to the same variables and functions as the `script` property (except the event-specific ones), plus the following:
|
||||
|
||||
- `value`: widget value
|
||||
- `event`: object containing the following:
|
||||
- `type`: `"start"` or `"stop"`
|
||||
- `handle`: `undefined` if the event concerns the widget, `integer` if it concerns one of it's handles (`multixy` and `range` widgets only)
|
||||
|
||||
Note: the [canvas](../canvas/) widgets exposes more informations in its `onTouch` script.
|
||||
|
||||
### `onDraw`
|
||||
|
||||
See [canvas](../canvas/).
|
||||
|
||||
### `onEvent`
|
||||
|
||||
*Script widget only*
|
||||
|
||||
This script is executed when the event specified in the `event` property occurs.
|
||||
|
||||
=== "Event: keyboard"
|
||||
|
|
@ -75,11 +96,6 @@ This script is executed when the event specified in the `event` property occurs.
|
|||
See `onValue`.
|
||||
|
||||
|
||||
### `onTouch` / `onDraw`
|
||||
|
||||
See [canvas](../canvas/).
|
||||
|
||||
|
||||
## Available variables
|
||||
|
||||
The following variables and functions are accessible in this context.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue