Module: Handy::Swipeable
- Defined in:
- (unknown)
Overview
An interface for swipeable widgets.
The HdySwipeable interface is implemented by all swipeable widgets. They
can be synced using [classSwipeGroup].
See [classSwipeTracker] for details about implementing it.
Instance Method Summary collapse
-
#cancel_progress ⇒ Float
Gets the progress self will snap back to after the gesture is canceled.
-
#distance ⇒ Float
Gets the swipe distance of self.
-
#emit_child_switched(index, duration) ⇒ nil
Emits [signalSwipeable::child-switched] signal.
-
#get_snap_points(n_snap_points) ⇒ Array<Float>
Gets the snap points of self.
-
#get_swipe_area(navigation_direction, is_drag, rect) ⇒ nil
Gets the area self can start a swipe from for the given direction and gesture type.
-
#progress ⇒ Float
Gets the current progress of self.
-
#swipe_tracker ⇒ Handy::SwipeTracker
Gets the [classSwipeTracker] used by this swipeable widget.
-
#switch_child(index, duration) ⇒ nil
Switches to child with index index.
Instance Method Details
#cancel_progress ⇒ Float
Gets the progress self will snap back to after the gesture is canceled.
#distance ⇒ Float
Gets the swipe distance of self.
This corresponds to how many pixels 1 unit represents.
#emit_child_switched(index, duration) ⇒ nil
Emits [signalSwipeable::child-switched] signal.
This should be called when the widget switches visible child widget.
duration can be 0 if the child is switched without animation.
#get_snap_points(n_snap_points) ⇒ Array<Float>
Gets the snap points of self.
Each snap point represents a progress value that is considered acceptable to end the swipe on.
#get_swipe_area(navigation_direction, is_drag, rect) ⇒ nil
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.
Swipe area is only considered for direct swipes (as in, not initiated by [classSwipeGroup]).
If not implemented, the default implementation returns the allocation of self, allowing swipes from anywhere.
#progress ⇒ Float
Gets the current progress of self.
#swipe_tracker ⇒ Handy::SwipeTracker
Gets the [classSwipeTracker] used by this swipeable widget.
#switch_child(index, duration) ⇒ nil
Switches to child with index index.
See [signalSwipeable::child-switched].