canvas: expose touch events for extra elements added with the html propery
This commit is contained in:
parent
6b76631003
commit
4ce9506e91
6 changed files with 27 additions and 12 deletions
|
|
@ -33,18 +33,24 @@ This script is executed when the widget is touched, when it is released, and dur
|
|||
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
|
||||
- `width`: widget width in pixels
|
||||
- `height`: widget height in pixels
|
||||
- `width`: canvas width in pixels
|
||||
- `height`: canvas height in pixels
|
||||
- `event`: object containing the following:
|
||||
- `type`: `"start"`, `"move"` or `"stop"`
|
||||
- `target`: id of the widget under the pointer, `"this"` if it's the canvas widget itself, `null` if no widget is under the pointer
|
||||
- `offsetX`, `offsetY`: touch coordinates in pixels, relative to `target`
|
||||
- `targetName`: name attribute of the html element under the pointer
|
||||
- `targetTagName`: tag name of the html element under the pointer
|
||||
- `offsetX`, `offsetY`: touch coordinates in pixels, relative to the html element under the pointer
|
||||
- `movementX`, `movementY`: movement of the pointer in pixels since the last event
|
||||
- `pointerId`: unique identifier used to differenciate fingers in multitouch situation
|
||||
- `altKey`, `ctrlKey`, `shiftKey`: keyboard modifier states
|
||||
- `force`: amount of pressure applied to the touch surface between `0` and `1` (see [Touch.force](https://developer.mozilla.org/en-US/docs/Web/API/Touch/force)). Equals `0` if the API is not supported or if no pressure information is found.
|
||||
|
||||
|
||||
!!! note "Extra html elements"
|
||||
Elements added using the `html` property can be touched as well, `event.targetName` can be used to determine which element is touched.
|
||||
|
||||
|
||||
### `draw`
|
||||
|
||||
This script is executed when the widget should be redrawn, which is when it's touched and when it receives a value.
|
||||
|
|
@ -52,8 +58,8 @@ This script is executed when the widget should be redrawn, which is when it's to
|
|||
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
|
||||
- `width`: widget width in pixels
|
||||
- `height`: widget height in pixels
|
||||
- `width`: canvas width in pixels
|
||||
- `height`: canvas height in pixels
|
||||
- `ctx`: [canvas rendering context](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) of the widget
|
||||
- `cssVars`: object containing the computed value of some of the widget's style properties such as `colorWidget`, `alphaFill`, `padding`, etc
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
| <h6 id="alphaFillOn">alphaFillOn<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#alphaFillOn" title="Permanent link">#</a></h6> | `number` | <code>"auto"</code> | Fill color opacity (on). |
|
||||
| <h6 id="lineWidth">lineWidth<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#lineWidth" title="Permanent link">#</a></h6> | `number` | <code>"auto"</code> | Stroke width. |
|
||||
| <h6 id="padding">padding<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#padding" title="Permanent link">#</a></h6> | `number` | <code>"auto"</code> | Inner spacing. |
|
||||
| <h6 id="html">html<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#html" title="Permanent link">#</a></h6> | `string` | <code>""</code> | Custom html content to be inserted in the widget (before the widget's content). Elements are all unstyled by default, `css` should be used to customize their appearance.<br/><br/>The code is automatically wrapped in <div class="html"></div><br/><br/>Allowed HTML tags:<br/><br/> h1-6, blockquote, p, a, ul, ol, nl, li,<br/><br/> b, i, strong, em, strike, code, hr, br, div,<br/><br/> table, thead, img, caption, tbody, tr, th, td, pre<br/><br/>Allowed attributes:<br/><br/> <*>: class, style, title<br/><br/> <img>: src, width, height |
|
||||
| <h6 id="html">html<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#html" title="Permanent link">#</a></h6> | `string` | <code>""</code> | Custom html content to be inserted in the widget (before the widget's content). Elements are all unstyled by default, `css` should be used to customize their appearance.<br/><br/>The code is automatically wrapped in <div class="html"></div><br/><br/>Allowed HTML tags:<br/><br/> h1-6, blockquote, p, a, ul, ol, nl, li,<br/><br/> b, i, strong, em, strike, code, hr, br, div,<br/><br/> table, thead, img, caption, tbody, tr, th, td, pre<br/><br/>Allowed attributes:<br/><br/> <*>: class, style, title, name<br/><br/> <img>: src, width, height |
|
||||
| <h6 id="css">css<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#css" title="Permanent link">#</a></h6> | `string` | <code>""</code> | CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.<br/><br/>Some style-related properties can be set or read from css using css variables:<br/>- `--color-background`: `colorBg`<br/>- `--color-widget`: `colorWidget`<br/>- `--color-fill`: `colorFill`<br/>- `--color-stroke`: `colorStroke`<br/>- `--color-text`: `colorText`<br/>- `--widget-padding`: `padding`<br/>- `--line-width`: `lineWidth`<br/>- `--alpha-fill-on`: `alphaFillOn`<br/>- `--alpha-fill-off`: `alphaFillOff`<br/>- `--alpha-stroke`: `alphaStroke` |
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue