canvas: expose additional touch event informations (radiusX, radiusY, rotationAngle and iOS-only altitudeAngle, azimuthAngle and touchType)

This commit is contained in:
jean-emmanuel 2022-01-11 19:00:25 +01:00
parent e466c66052
commit 6b1f782d33
3 changed files with 13 additions and 2 deletions

View file

@ -9,6 +9,8 @@
- widgets
- renamed `script` to `onValue`, `draw` to `onDraw`, `touch` to `onTouch`
- added `onCreate` script property to all widgets
- canvas: expose additional touch event informations (`radiusX`, `radiusY`, `rotationAngle` and iOS-only `altitudeAngle`, `azimuthAngle` and `touchType`)
## 1.13.2

View file

@ -45,6 +45,9 @@ This script has access to the same variables and functions as the `script` prope
- `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.
- `radiusX`, `radiusY`, `rotationAngle`: see [Touch.rotationAngle](https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle)
- (iOS only) `altitudeAngle`, `azimuthAngle`: see [Touch.altitudeAngle](https://w3c.github.io/touch-events/#dom-touch-altitudeangle)
- (iOS only) `touchType`: "direct" or "stylus"
!!! note "Extra html elements"

View file

@ -29,8 +29,14 @@ module.exports = {
traversingStack: e.traversingStack,
multitouch: e.multitouch,
isTouch: e instanceof Touch,
force: e.webkitForce || e.force || 0
force: e.webkitForce || e.force || 0,
radiusX: e.radiusX,
radiusY: e.radiusY,
rotationAngle: e.rotationAngle,
// iOS only
altitudeAngle: e.altitudeAngle,
azimuthAngle: e.azimuthAngle,
touchType: e.touchType
}
},