diff --git a/CHANGELOG.md b/CHANGELOG.md index b06f3c8a..07484ed2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/resources/docs/docs/widgets/canvas.md b/resources/docs/docs/widgets/canvas.md index 66c08f9a..2864d835 100644 --- a/resources/docs/docs/widgets/canvas.md +++ b/resources/docs/docs/widgets/canvas.md @@ -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` diff --git a/src/client/events/utils.js b/src/client/events/utils.js index 8f54bb63..35d4355c 100644 --- a/src/client/events/utils.js +++ b/src/client/events/utils.js @@ -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 + } },