Add touchpad magnify and rotate gestures support for macOS (#2157)
* Add touchpad magnify support for macOS * Add touchpad rotate support for macOS * Add macOS rotate and magnify gesture cancelled phases * Correct docs for TouchpadRotate event * Fix tracing macros
This commit is contained in:
parent
76f158d310
commit
da2cef97a3
4 changed files with 174 additions and 0 deletions
64
src/event.rs
64
src/event.rs
|
|
@ -426,6 +426,34 @@ pub enum WindowEvent<'a> {
|
|||
modifiers: ModifiersState,
|
||||
},
|
||||
|
||||
/// Touchpad magnification event with two-finger pinch gesture.
|
||||
///
|
||||
/// Positive delta values indicate magnification (zooming in) and
|
||||
/// negative delta values indicate shrinking (zooming out).
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - Only available on **macOS**.
|
||||
TouchpadMagnify {
|
||||
device_id: DeviceId,
|
||||
delta: f64,
|
||||
phase: TouchPhase,
|
||||
},
|
||||
|
||||
/// Touchpad rotation event with two-finger rotation gesture.
|
||||
///
|
||||
/// Positive delta values indicate rotation counterclockwise and
|
||||
/// negative delta values indicate rotation clockwise.
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - Only available on **macOS**.
|
||||
TouchpadRotate {
|
||||
device_id: DeviceId,
|
||||
delta: f32,
|
||||
phase: TouchPhase,
|
||||
},
|
||||
|
||||
/// Touchpad pressure event.
|
||||
///
|
||||
/// At the moment, only supported on Apple forcetouch-capable macbooks.
|
||||
|
|
@ -549,6 +577,24 @@ impl Clone for WindowEvent<'static> {
|
|||
button: *button,
|
||||
modifiers: *modifiers,
|
||||
},
|
||||
TouchpadMagnify {
|
||||
device_id,
|
||||
delta,
|
||||
phase,
|
||||
} => TouchpadMagnify {
|
||||
device_id: *device_id,
|
||||
delta: *delta,
|
||||
phase: *phase,
|
||||
},
|
||||
TouchpadRotate {
|
||||
device_id,
|
||||
delta,
|
||||
phase,
|
||||
} => TouchpadRotate {
|
||||
device_id: *device_id,
|
||||
delta: *delta,
|
||||
phase: *phase,
|
||||
},
|
||||
TouchpadPressure {
|
||||
device_id,
|
||||
pressure,
|
||||
|
|
@ -637,6 +683,24 @@ impl<'a> WindowEvent<'a> {
|
|||
button,
|
||||
modifiers,
|
||||
}),
|
||||
TouchpadMagnify {
|
||||
device_id,
|
||||
delta,
|
||||
phase,
|
||||
} => Some(TouchpadMagnify {
|
||||
device_id,
|
||||
delta,
|
||||
phase,
|
||||
}),
|
||||
TouchpadRotate {
|
||||
device_id,
|
||||
delta,
|
||||
phase,
|
||||
} => Some(TouchpadRotate {
|
||||
device_id,
|
||||
delta,
|
||||
phase,
|
||||
}),
|
||||
TouchpadPressure {
|
||||
device_id,
|
||||
pressure,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue