W3CPointerEvents: add missing attributes to pointer events (#37537)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Alex Danoff
2023-05-25 13:22:56 -07:00
committed by Facebook GitHub Bot
parent 20808b5eb5
commit 58ef9e92de
@@ -222,6 +222,8 @@ public class PointerEvent extends Event<PointerEvent> {
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);
@@ -241,6 +243,7 @@ public class PointerEvent extends Event<PointerEvent> {
pointerEvent.putDouble(
"pressure", PointerEventHelper.getPressure(pointerEvent.getInt("buttons"), mEventName));
pointerEvent.putDouble("tangentialPressure", 0.0);
return pointerEvent;
}