Add tangentialPressure property to PointerEvent interface

Summary:
Changelog: [iOS][internal] - Add tangentialPressure property to PointerEvent interface

This diff adds the tangentialPressure property to the PointerEvent implementation on iOS. This one is pretty simple considering iOS doesn't have the concept of tangential pressure so we just hard code it to 0 as defined by the spec.

Reviewed By: lunaleaps

Differential Revision: D37759634

fbshipit-source-id: 7ca0e47267f5fde76ace2b96d05ea2e154cb4b8f
This commit is contained in:
Vincent Riemer
2022-07-12 18:10:27 -07:00
committed by Facebook GitHub Bot
parent d82cd3cbce
commit 3cc335e615
4 changed files with 13 additions and 1 deletions
+3
View File
@@ -279,6 +279,8 @@ static PointerEvent CreatePointerEventFromActiveTouch(ActiveTouch activeTouch, R
event.buttons = 0;
}
event.tangentialPressure = 0.0;
return event;
}
@@ -299,6 +301,7 @@ CreatePointerEventFromIncompleteHoverData(UIView *view, CGPoint clientLocation,
event.tiltY = 0;
event.detail = 0;
event.buttons = 0;
event.tangentialPressure = 0.0;
return event;
}
@@ -30,6 +30,8 @@ std::vector<DebugStringConvertibleObject> getDebugProps(
{"tiltY", getDebugDescription(pointerEvent.tiltY, options)},
{"detail", getDebugDescription(pointerEvent.detail, options)},
{"buttons", getDebugDescription(pointerEvent.buttons, options)},
{"tangentialPressure",
getDebugDescription(pointerEvent.tangentialPressure, options)},
};
}
@@ -56,7 +56,7 @@ struct PointerEvent {
* the X axis.
*/
int tiltY;
/**
/*
* Returns a long with details about the event, depending on the event type.
*/
int detail;
@@ -64,6 +64,12 @@ struct PointerEvent {
* The buttons being depressed (if any) when the mouse event was fired.
*/
int buttons;
/*
* The normalized tangential pressure of the pointer input (also known as
* barrel pressure or cylinder stress) in the range -1 to 1, where 0 is the
* neutral position of the control.
*/
Float tangentialPressure;
};
#if RN_DEBUG_STRING_CONVERTIBLE
@@ -74,6 +74,7 @@ static jsi::Value pointerEventPayload(
object.setProperty(runtime, "tiltY", event.tiltY);
object.setProperty(runtime, "detail", event.detail);
object.setProperty(runtime, "buttons", event.buttons);
object.setProperty(runtime, "tangentialPressure", event.tangentialPressure);
return object;
}