-
-
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
Changes from 3 commits
257b43e
88ad53f
c4ec674
a3341c2
97273ad
4711c59
e22912c
3191236
90dbb8e
45e7e33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,32 @@ pub struct MouseWheel { | |
pub y: f32, | ||
} | ||
|
||
/// Touchpad magnification event with two-finger pinch gesture. | ||
/// | ||
/// Positive delta values indicate magnification (zooming in) and | ||
/// negative delta values indicate shrinking (zooming out). | ||
#[derive(Event, Debug, Clone, Copy, PartialEq, Reflect, FromReflect)] | ||
#[reflect(Debug, PartialEq)] | ||
#[cfg_attr( | ||
feature = "serialize", | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Should these also be prefixed with There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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. |
||
|
||
/// Touchpad rotation event with two-finger rotation gesture. | ||
/// | ||
/// Positive delta values indicate rotation counterclockwise and | ||
/// negative delta values indicate rotation clockwise. | ||
#[derive(Event, Debug, Clone, Copy, PartialEq, Reflect, FromReflect)] | ||
#[reflect(Debug, PartialEq)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
#[cfg_attr( | ||
feature = "serialize", | ||
derive(serde::Serialize, serde::Deserialize), | ||
reflect(Serialize, Deserialize) | ||
)] | ||
pub struct Rotate(pub f32); | ||
|
||
/// Updates the [`Input<MouseButton>`] resource with the latest [`MouseButtonInput`] events. | ||
/// | ||
/// ## Differences | ||
|
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 inbevy_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.