-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Touchpad magnify and rotate events #8791
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The platform limitations should be listed in the docs for each struct, and mentioned in the example. Good addition though!
crates/bevy_input/src/mouse.rs
Outdated
/// | ||
/// - Only available on **`macOS`**. | ||
#[derive(Event, Debug, Clone, Copy, PartialEq, Reflect, FromReflect)] | ||
#[reflect(Debug, PartialEq)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add FromReflect
to this attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that already the case? It is the last argument to #[derive(...)]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, to clarify I’m referring to adding a ReflectFromReflect
registration like #[reflect(Debug, PartialEq, FromReflect)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. I've added it to #[reflect(...)]
but the reason for it not being initially there is that none of the types in bevy_input::mouse
use it. So its probably missing there as well, right? Or is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it should be there as well. #8776 addresses that issue.
crates/bevy_input/src/mouse.rs
Outdated
/// | ||
/// - Only available on **`macOS`**. | ||
#[derive(Event, Debug, Clone, Copy, PartialEq, Reflect, FromReflect)] | ||
#[reflect(Debug, PartialEq)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
crates/bevy_input/src/mouse.rs
Outdated
derive(serde::Serialize, serde::Deserialize), | ||
reflect(Serialize, Deserialize) | ||
)] | ||
pub struct Magnify(pub f32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these also be prefixed with Touchpad
for clarity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved these types into their own module as I think that this is more future proof.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like they should still be renamed to tie them back to the touchpad. Rotate
especially is pretty generic and could be confusing to some users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Also tested on my MacBook and it seems to be working!
Objective
The goal of this PR is to receive touchpad magnification and rotation events.
Solution
Implement pendants for winit's
TouchpadMagnify
andTouchpadRotate
events.Adjust the
mouse_input_events.rs
example to debug magnify and rotate events.Since winit only reports these events on macOS, the Bevy events for touchpad magnification and rotation are currently only fired on macOS.