Skip to content

Web: fix MouseMotion coordinate space#3770

Merged
daxpedda merged 1 commit intorust-windowing:masterfrom
daxpedda:web-mouse-motion
Jul 5, 2024
Merged

Web: fix MouseMotion coordinate space#3770
daxpedda merged 1 commit intorust-windowing:masterfrom
daxpedda:web-mouse-motion

Conversation

@daxpedda
Copy link
Copy Markdown
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 added the DS - web Affects the Web backend (WebAssembly/WASM) label Jul 1, 2024
@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
@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

DS - web Affects the Web backend (WebAssembly/WASM)

Development

Successfully merging this pull request may close these issues.

2 participants