Skip to content

Commit

Permalink
W3CPointerEvents: add missing attributes to pointer events (facebook#…
Browse files Browse the repository at this point in the history
…37537)

Summary:
Pull Request resolved: facebook#37537

Changelog: [Internal] [Changed] - W3CPointerEvents: add missing attributes to pointer events

The [PointerEvent interface](https://www.w3.org/TR/pointerevents/#pointerevent-interface) includes some additional properties which we weren't including in the events we dispatched.

This diff adds them (set to default values):
- twist
- tangentialPressure

In the future, we can try to set reasonable values for these properties based on the underlying native events.

Reviewed By: NickGerleman

Differential Revision: D45747033

fbshipit-source-id: 529f9d90299f33bc04eae3fb85ddd7eac3d61c5b
  • Loading branch information
Alex Danoff authored and facebook-github-bot committed May 25, 2023
1 parent 20808b5 commit 58ef9e9
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ private WritableMap createW3CPointerEvent(int index) {
pointerEvent.putDouble("tiltX", 0);
pointerEvent.putDouble("tiltY", 0);

pointerEvent.putInt("twist", 0);

if (pointerType.equals(PointerEventHelper.POINTER_TYPE_MOUSE)) {
pointerEvent.putDouble("width", 1);
pointerEvent.putDouble("height", 1);
Expand All @@ -241,6 +243,7 @@ private WritableMap createW3CPointerEvent(int index) {

pointerEvent.putDouble(
"pressure", PointerEventHelper.getPressure(pointerEvent.getInt("buttons"), mEventName));
pointerEvent.putDouble("tangentialPressure", 0.0);

return pointerEvent;
}
Expand Down

0 comments on commit 58ef9e9

Please sign in to comment.