Gnome::Gtk4::GestureSwipe
#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------
Description
Gnome::Gtk4::GestureSwipe is a Gnome::Gtk4::Gesture for swipe gestures.
After a press/move/.../move/release sequence happens, the swipe signal will be emitted, providing the velocity and directionality of the sequence at the time it was lifted.
If the velocity is desired in intermediate points, .get-velocity() can be called in a update defined in Gesture handler.
All velocities are reported in pixels/sec units.
Uml Diagram =for image :src<asset_files/images/plantuml/GestureSwipe.png> :width<70%> :class<inline>
#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------
Class initialization
new
:native-object
Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object() :$native-object! )
#-------------------------------------------------------------------------------
new-gestureswipe
Returns a newly created Gnome::Gtk4::Gesture that recognizes swipes.
method new-gestureswipe ( --> Gnome::Gtk4::GestureSwipe )
#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------
Methods
#-------------------------------------------------------------------------------
get-velocity
Gets the current velocity.
If the gesture is recognized, this function returns True and fills
in $velocity-x and $velocity-y with the recorded velocity, as per the
last events processed.
method get-velocity ( Num() $velocity-x, Num() $velocity-y --> Bool )
$velocity-x; (transfer ownership: full) return value for the velocity in the X axis, in pixels/sec.
$velocity-y; (transfer ownership: full) return value for the velocity in the Y axis, in pixels/sec.
Return value; whether velocity could be calculated.
#------------------------------------------------------------------------------- #--[Signal Documentation]------------------------------------------------------- #-------------------------------------------------------------------------------
Signals
swipe
Emitted when the recognized gesture is finished.
Velocity and direction are a product of previously recorded events.
method handler (
gdouble $velocity-x,
gdouble $velocity-y,
Int :$_handle_id,
N-GObject :$_native-object,
Gnome::Gtk4::GestureSwipe :$_widget,
*%user-options
)
$velocity-x; velocity in the X axis, in pixels/sec.
$velocity-y; velocity in the Y axis, in pixels/sec.
$_handle_id; The registered event handler id.
$_native-object; The native object provided by the Raku object which registered this event. This is a native Gnome::Gtk4::GestureSwipe object.
%user-options; A list of named arguments provided by .register-signal() in class Object.