Skip to content

Define pointermove and pointerrawupdate may have delta from previous corresponding pointer event as movementX and movementY #535

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
masayuki-nakano opened this issue Jan 6, 2025 · 4 comments
Assignees
Labels

Comments

@masayuki-nakano
Copy link

MouseEvent.movementX and MouseEvent.movementY are extensions of Pointer Lock 2.0 and the spec of Pointer Events does not refer these attributes. As of current definition, those values of pointermove and pointerrawupdate should be 0. However, Chromium explicitly sets them.

I think that the Chromium's behavior is reasonable and Mozilla got a bug report about this. So, I suggest that the spec of Pointer Events should define pointermove and pointerrawupdate may have non-zero values of movementX and movementY.

  • If the event type is pointermove, the source event of the last position should be pointerdown, pointermove or pointerup which had same pointerId
  • If the event type is pointerrawupdate, the source event of the last position should be pointerrawupdate which had same pointerId
  • At same time of Pointer Lock definition, the last position should be reset.

Then, it would be better to redesign the type of movementX and movementY are double, but it must be better browsers to keep rounding the values of MouseEvent to integer for backward compatibility.

@smaug----
Copy link
Contributor

Looks like this is basically a duplicate of w3c/pointerlock#100

@patrickhlauke
Copy link
Member

Discussed at meeting today: we plan to keep this issue open until the pointerlock issue is closed, but group fundamentally thinks this should be handled there rather than in pointer events.

@smaug----
Copy link
Contributor

@masayuki-nakano do browsers currently use non-fractional values with mousemove?

@mustaqahmed mustaqahmed self-assigned this Feb 12, 2025
@masayuki-nakano
Copy link
Author

@masayuki-nakano do browsers currently use non-fractional values with mousemove?

First, Firefox always use integer coordinates, and also as far as I've checked, Chromium always use std::floor in the getter methods of MouseEvent.

I'm not sure about Safari, but looks like WebKit's MouseEvent is always initialized with integer coordinates. And anyway, it seems that they don't support fractional coordinates even with PointerEvent.

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

4 participants