Struct NavGestureRecognizer
pub struct NavGestureRecognizer { /* private fields */ }Expand description
Recognises back/forward navigation gestures from touchpad swipes and
touchscreen edge pulls. One instance lives on the App; feed it every
scroll and touch event and act on the Some(NavDirection) it returns.
Implementations§
pub fn new() -> NavGestureRecognizer
pub fn on_scroll(
&mut self,
dx: f64,
dy: f64,
phase: GesturePhase,
precise: bool,
) -> Option<NavDirection>
pub fn on_scroll( &mut self, dx: f64, dy: f64, phase: GesturePhase, precise: bool, ) -> Option<NavDirection>
Feed a scroll sample. precise is true for pixel-precise
touchpad scroll and false for a notched mouse wheel — only the
former can be a two-finger swipe, so a horizontal wheel tilt never
navigates. Returns a direction exactly once per gesture, when the
accumulated horizontal travel crosses the threshold while staying
dominantly horizontal.
pub fn on_touch(
&mut self,
id: u64,
x: f64,
_y: f64,
phase: GesturePhase,
window_width: f64,
) -> Option<NavDirection>
pub fn on_touch( &mut self, id: u64, x: f64, _y: f64, phase: GesturePhase, window_width: f64, ) -> Option<NavDirection>
Feed a touch sample (physical coordinates + the window’s physical width, for edge detection). A finger that starts within the edge zone and is dragged inward past the threshold navigates once: left edge → Back, right edge → Forward (the phone/tablet convention).
Trait Implementations§
§fn default() -> NavGestureRecognizer
fn default() -> NavGestureRecognizer
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more