-
-
Notifications
You must be signed in to change notification settings - Fork 987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Web] Stylus support #3107
[Web] Stylus support #3107
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good 👍
src/web/tools/PointerEventManager.ts
Outdated
// Stylus triggers `pointermove` event when it detects changes in pressure. Since it is very sensitive to those changes, | ||
// it constantly sends events, even though there was no change in position. To fix that we check whether | ||
// pointer has actually moved and if not, we do not send event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not true anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Removed in f98b911
src/web/utils.ts
Outdated
// or that none of the position sets is supported. In that case, we can treat stylus as perpendicular | ||
// | ||
// @ts-ignore This property exists (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#instance_properties) | ||
if (event.azimuthAngle === undefined || event.altitudeAngle === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can extract those to variables instead of @ts-ignoring
multiple times
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done in 9fa4003
## Description This PR adds stylus support on Android. >[!NOTE] > You can read more about this feature in #3107 ## Test plan Tested on **_StylusData_** example
## Description This PR adds stylus support on `iOS`. >[!WARNING] > This PR lacks support for `Hover` since currently we are unable to test that. >[!NOTE] > You can read more about this feature in #3107 ## Test plan Tested on **_StylusData_** example
Description
This PR adds more information about
stylus
to event.Pan
andHover
events now havestylusData
field, which contains the following information:tiltX
tiltY
altitudeAngle
azimuthAngle
pressure
Important
Because we receive only one set of data (either
tiltX/tiltY
oraltitudeAngle/azimuthAngle
, we use this conversion algorithm to calculate second set.Note
This PR adds
stylusData
only on web, native platforms will be handled in another PRsTest plan
Tested on newly added example.