pub trait SwipeableExt: IsA<Swipeable> + Sealed + 'static {
    // Provided methods
    fn cancel_progress(&self) -> f64 { ... }
    fn distance(&self) -> f64 { ... }
    fn progress(&self) -> f64 { ... }
    fn snap_points(&self) -> Vec<f64> { ... }
    fn swipe_area(
        navigation_direction: NavigationDirection,
        is_drag: bool
    ) -> Rectangle { ... }
Expand description

Trait containing all Swipeable methods.


Carousel, Flap, Leaflet, NavigationView, OverlaySplitView, Swipeable

Provided Methods§


fn cancel_progress(&self) -> f64

Gets the progress @self will snap back to after the gesture is canceled.


the cancel progress, unitless


fn distance(&self) -> f64

Gets the swipe distance of @self.

This corresponds to how many pixels 1 unit represents.


the swipe distance in pixels


fn progress(&self) -> f64

Gets the current progress of @self.


the current progress, unitless


fn snap_points(&self) -> Vec<f64>

Gets the snap points of @self.

Each snap point represents a progress value that is considered acceptable to end the swipe on.


the snap points


fn swipe_area( &self, navigation_direction: NavigationDirection, is_drag: bool ) -> Rectangle

Gets the area @self can start a swipe from for the given direction and gesture type.

This can be used to restrict swipes to only be possible from a certain area, for example, to only allow edge swipes, or to have a draggable element and ignore swipes elsewhere.

If not implemented, the default implementation returns the allocation of @self, allowing swipes from anywhere.

the direction of the swipe


whether the swipe is caused by a dragging gesture


a pointer to a rectangle to store the swipe area

Object Safety§

This trait is not object safe.