-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Distinction between MouseMotion and CursorMoved events is unclear in docs #5083
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
Comments
It's also not clear why one refers to "mouse" and the other refers to "cursor". Perhaps there's a significance to this upstream in |
And of course, |
My understanding is that mouse motion is about the physical motion of the actual mouse - this ignores pointer acceleration for example. Cursor movement is about the movement of the cursor, i.e. the thing that you use to click with. |
# Objective - Fixes bevyengine#5083 ## Solution I looked at the implementation of those events. I noticed that they both are adaptations of `winit`'s `DeviceEvent`/`WindowEvent` enum variants. Therefore I based the description of the items on the documentation provided by the upstream crate. I also added a link to `CursorMoved`, just like `MouseMotion` already has. ## Observations - Looking at the implementation of `MouseMotion`, I noticed the `DeviceId` field of the `winit` event is discarded by `bevy_input`. This means that in the case a machine has multiple pointing devices, it is impossible to distinguish to which one the event is referring to. **EDIT:** just tested, `MouseMotion` events are emitted for movement of both mice.
# Objective - Fixes bevyengine#5083 ## Solution I looked at the implementation of those events. I noticed that they both are adaptations of `winit`'s `DeviceEvent`/`WindowEvent` enum variants. Therefore I based the description of the items on the documentation provided by the upstream crate. I also added a link to `CursorMoved`, just like `MouseMotion` already has. ## Observations - Looking at the implementation of `MouseMotion`, I noticed the `DeviceId` field of the `winit` event is discarded by `bevy_input`. This means that in the case a machine has multiple pointing devices, it is impossible to distinguish to which one the event is referring to. **EDIT:** just tested, `MouseMotion` events are emitted for movement of both mice.
# Objective - Fixes bevyengine#5083 ## Solution I looked at the implementation of those events. I noticed that they both are adaptations of `winit`'s `DeviceEvent`/`WindowEvent` enum variants. Therefore I based the description of the items on the documentation provided by the upstream crate. I also added a link to `CursorMoved`, just like `MouseMotion` already has. ## Observations - Looking at the implementation of `MouseMotion`, I noticed the `DeviceId` field of the `winit` event is discarded by `bevy_input`. This means that in the case a machine has multiple pointing devices, it is impossible to distinguish to which one the event is referring to. **EDIT:** just tested, `MouseMotion` events are emitted for movement of both mice.
What problem does this solve or what need does it fill?
As shown in the mouse_input_events example, Bevy exposes both a
MouseMotion
andCursorMoved
event type.These are poorly documented, but it appears that
MouseMotion
is relative, whileCursorPosition
is absolute (and tied to a specific window).What solution would you like?
Clearly differentiate these types in the docs and explain why they both exist (and when you should use one vs the other).
What alternative(s) have you considered?
Remove
MouseMotion
, and only exposeCursorMoved
. However, it's not clear ifMouseMotion
can always be reconstructed; I'm particularly nervous about what happens when the cursor is locked to the screen.Additional context
Related to #5034, which also tries to simplify the UX here.
The text was updated successfully, but these errors were encountered: