Support pinch, double tap and rotation gestures on iOS (#3130)
This is off by default on iOS. Note that pinch delta may be NaN. Co-authored-by: Mads Marquart <mads@marquart.dk>
This commit is contained in:
parent
30775f4982
commit
6b29253797
10 changed files with 362 additions and 34 deletions
|
|
@ -85,6 +85,21 @@ pub trait WindowExtIOS {
|
|||
/// [`setNeedsStatusBarAppearanceUpdate()`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621354-setneedsstatusbarappearanceupdat?language=objc)
|
||||
/// is also called for you.
|
||||
fn set_preferred_status_bar_style(&self, status_bar_style: StatusBarStyle);
|
||||
|
||||
/// Sets whether the [`Window`] should recognize pinch gestures.
|
||||
///
|
||||
/// The default is to not recognize gestures.
|
||||
fn recognize_pinch_gesture(&self, should_recognize: bool);
|
||||
|
||||
/// Sets whether the [`Window`] should recognize double tap gestures.
|
||||
///
|
||||
/// The default is to not recognize gestures.
|
||||
fn recognize_doubletap_gesture(&self, should_recognize: bool);
|
||||
|
||||
/// Sets whether the [`Window`] should recognize rotation gestures.
|
||||
///
|
||||
/// The default is to not recognize gestures.
|
||||
fn recognize_rotation_gesture(&self, should_recognize: bool);
|
||||
}
|
||||
|
||||
impl WindowExtIOS for Window {
|
||||
|
|
@ -124,6 +139,24 @@ impl WindowExtIOS for Window {
|
|||
self.window
|
||||
.maybe_queue_on_main(move |w| w.set_preferred_status_bar_style(status_bar_style))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn recognize_pinch_gesture(&self, should_recognize: bool) {
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.recognize_pinch_gesture(should_recognize));
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn recognize_doubletap_gesture(&self, should_recognize: bool) {
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.recognize_doubletap_gesture(should_recognize));
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn recognize_rotation_gesture(&self, should_recognize: bool) {
|
||||
self.window
|
||||
.maybe_queue_on_main(move |w| w.recognize_rotation_gesture(should_recognize));
|
||||
}
|
||||
}
|
||||
|
||||
/// Additional methods on [`WindowBuilder`] that are specific to iOS.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue