/!\ events: groundwork for containers onTouch scripts:

Drag events are now reverse-bubbling (from parents to child) to allow containers to monitor/control interaction inside them
This commit is contained in:
jean-emmanuel 2025-03-21 09:23:44 +01:00
parent e001d3be10
commit 4d30880d0f
6 changed files with 79 additions and 9 deletions

View file

@ -42,6 +42,7 @@ This script has access to the same variables and functions as the `script` prope
- `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
- `pageX`, `pageY`: touch coordinates in pixels, relative to the page
- `pointerId`: unique identifier used to differentiate 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.

View file

@ -78,7 +78,15 @@ This script has access to the same variables and functions as the `script` prope
- `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.
[Canvas](../canvas/) and containers expose more informations in their `onTouch` script.
??? infos "Containers onTouch"
Containers (root, panel, etc) can monitor touch events happening inside them, it works like with [Canvas](../canvas/#ontouch), with a few differences:
- setting `event.preventDefault` to `true` will prevent the event from reaching widgets in the container ('start' and 'move' events only)
- setting `event.allowScroll` to `true` will allow touch scrolling where it would normally be prevented ('start' event only)
- `width` and `height` are undefined
### `onDraw`