Skip to content

Binding for tilt_x etc on PointerEvents is wrong #4501

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

Open
wareya opened this issue May 4, 2025 · 2 comments
Open

Binding for tilt_x etc on PointerEvents is wrong #4501

wareya opened this issue May 4, 2025 · 2 comments
Labels

Comments

@wareya
Copy link

wareya commented May 4, 2025

Describe the Bug

e.g.

pub fn tilt_x(this: &PointerEvent) -> i32;

Return value is i32, but it needs to be Option<i32>.

Additional Context

tiltX, tiltY, azimuthAngle, and altitudeAngle are only reported if that is the format that is reported by the pointing device, and whether or not they are supported is necessary information because otherwise the application does not know which one to use. If they are unsupported, they evaluate to undefined instead of a number. Throwing that information away and returning a dummy value or throwing a panic makes it impossible to use them correctly.

@wareya wareya added the bug label May 4, 2025
@wareya
Copy link
Author

wareya commented May 4, 2025

Oh, i32 is totally wrong anyway, it should be f64 or f32. Devices can report fractional values for these even though it's rare to do so.

@wareya
Copy link
Author

wareya commented May 4, 2025

Huh, this might actually be a Firefox bug? I was getting undefined for azimuth/altitude angle with on device that didn't report it, but the spec (https://www.w3.org/TR/pointerevents/#dom-pointerevent-altitudeangle) specifies:

For hardware and platforms that do not report tilt or angle, the value MUST be π/2.

...But it IS reporting tilt/angle, just in tiltX and tiltY instead of azimuthAngle/altitudeAngle. And Firefox isn't converting from tiltX/tiltY to azimuth/altitude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant