canvas: expose touch pressure (as event.force) in the touch script.

This commit is contained in:
jean-emmanuel 2021-12-19 17:41:17 +01:00
parent cb68a80309
commit 447729443f
3 changed files with 9 additions and 1 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## 1.13.2
- widgets
- canvas: expose touch pressure (as `event.force`) in the `touch` script.
## 1.13.1
- bug fixes

View file

@ -42,6 +42,7 @@ This script has access to the same variables and functions as the `script` prope
- `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.
### `draw`

View file

@ -28,7 +28,9 @@ module.exports = {
traversing: e.traversing,
traversingStack: e.traversingStack,
multitouch: e.multitouch,
isTouch: e instanceof Touch
isTouch: e instanceof Touch,
force: e.webkitForce || e.force || 0
}
},