Skip to content
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: fix MouseMotion coordinate space #3770

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

daxpedda
Copy link
Member

@daxpedda daxpedda commented Jul 1, 2024

This basically reverts #3766.

Reason being that screenX/Y doesn't work when locking the pointer. Its also not ideal because when you move the pointer out of the frame and enter it again, it pretends like the mouse moved a lot, which is quite different then what movementX/Y reports and probably not what we want.

Seeing that its unclear in the spec how browsers should implement movementX/Y I also opened w3c/pointerlock#100.

Now that we don't have a choice but use movementX/Y we have to account for the following:

  1. Pretend like Unclear if pointermove should set movementX/Y w3c/pointerlock#100 has been resolved and all browsers actually set values there instead of zero. Which they currently do.
  2. Account for browsers not actually following the spec which coordinate system to use. See movementX/Y coordinate space w3c/pointerlock#42.
  3. Account for Firefox actually being buggy when un-coalescing events. See Bugzilla.

To account for all these issues, I added some browser engine detection code, which I might expose to the user in a follow-up PR.

Also have to update #2875 after this is merged.

@daxpedda daxpedda force-pushed the web-mouse-motion branch from 785d4e7 to 5787de1 Compare July 1, 2024 11:42
@daxpedda daxpedda added this to the Version 0.30.4 milestone Jul 1, 2024
@daxpedda daxpedda force-pushed the web-mouse-motion branch from 5787de1 to f64404b Compare July 5, 2024 13:22
@daxpedda daxpedda force-pushed the web-mouse-motion branch from f64404b to 0a6aa16 Compare July 5, 2024 13:55
@daxpedda daxpedda merged commit 936da13 into rust-windowing:master Jul 5, 2024
53 checks passed
@daxpedda daxpedda mentioned this pull request Jul 7, 2024
25 tasks
daxpedda added a commit that referenced this pull request Jul 16, 2024
kchibisov pushed a commit that referenced this pull request Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants