Repository navigation
Add DeviceEvent::MouseMove on web platform to support pointer lock - #1827
Conversation
|
Looks ok-ish to me (haven't tested yet) @ryanisaacg perhaps you can give this a look if you have time? |
|
LGTM |
|
Would y'all be ok to merge this PR if everything looks good? (cc @alvinhochun ) |
|
Should this close this issue #1792 ? |
|
Probably. |
|
I found a way to make this compatible with bevy 0.5 from crates.io, it requires you to patch winit that is used in all bevy related assets. I created a branch that contains @willcrichtons implementation, and on top of that added some dummy-fixes that enables the latest version of winit, with all the fixes included to be patched on top of bevy 0.5. Meaning that all addon crates also works with this ( as far as i can tell). It only requires two lines to the Cargo.toml file of your project TLDR: Add the below to your Cargo.toml to enable cursor grab in web, for bevy 0.5 projects. |
I'm using winit with web/wasm via Bevy. Bevy relies on
DeviceEvent::MouseMotionevents to compute mouse movement deltas, andDeviceEvent::MouseMotionwas not implemented for the web platform.WindowEvent::CursorMovedevents didn't work for my use case because the x/y didn't update as the cursor moved when locked. I added aMouseMotionevent to the web platform that uses themovement_x/yfields. I tested that my changes work within a Bevy web app.I'm not sure if this is the "Device movement events" entry in the "Input handling" feature matrix?