Skip to content

Web: Remove some unnecessary compatibility code#3766

Merged
daxpedda merged 1 commit intorust-windowing:masterfrom
daxpedda:web-movement-screen
Jun 28, 2024
Merged

Web: Remove some unnecessary compatibility code#3766
daxpedda merged 1 commit intorust-windowing:masterfrom
daxpedda:web-movement-screen

Conversation

@daxpedda
Copy link
Copy Markdown
Member

Apparently MouseEvent.movementX/Y should not be used anymore.
Replacing it with screenX/Y simplifies the code, removes unnecessary conversion and increases accuracy.

Addresses #2875.

@daxpedda daxpedda added the DS - web Affects the Web backend (WebAssembly/WASM) label Jun 28, 2024
@daxpedda daxpedda added this to the Version 0.30.4 milestone Jun 28, 2024
Copy link
Copy Markdown
Member

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a reason why we didn't use screen[X|Y] before?

@daxpedda daxpedda force-pushed the web-movement-screen branch from 91aac75 to bbf16bc Compare June 28, 2024 22:45
@daxpedda
Copy link
Copy Markdown
Member Author

Was there a reason why we didn't use screen[X|Y] before?

movementX/Y is what we actually want here, but apparently the spec says:
https://w3c.github.io/pointerlock/#dom-mouseevent-movementx

movementX and movementY must be zero for all mouse events except mousemove.

We moved from mouse to pointer events (mousemove -> pointermove), so that doesn't really work out for us.
It worked until now because all browsers just don't follow the spec.

@daxpedda daxpedda merged commit 2e93e48 into rust-windowing:master Jun 28, 2024
@daxpedda daxpedda removed this from the Version 0.30.4 milestone Jul 1, 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