drag: safe user custom inertia and docs

This commit is contained in:
jean-emmanuel 2025-03-21 15:38:58 +01:00
parent 0b3590278c
commit 69fbefdb73
2 changed files with 2 additions and 1 deletions

View file

@ -86,6 +86,7 @@ This script has access to the same variables and functions as the `script` prope
- 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)
- setting `event.inertia` will affect 'move' events (works like widget `sensitivity` in reverse (1 = normal, 10 = slow move))
- `width` and `height` are undefined
Containers with `traversing` enabled change how touch events are emitted:

View file

@ -376,7 +376,7 @@ class Panel extends Container() {
event: event
}, {sync: true, send: true})
e.inertia = event.inertia
e.inertia = parseFloat(event.inertia) || 1
if (name != 'stop' && event.preventDefault) e.preventDefault = true
if (event.allowScroll) e.allowScroll = true