Action enabling dragging on actors
<clutter-drag-action> is a sub-class of
that implements all the necessary logic for dragging actors.
The simplest usage of
<clutter-drag-action> consists in adding it
<clutter-actor> and setting it as reactive; for instance,
the following code:
clutter_actor_add_action (actor, clutter_drag_action_new ()); clutter_actor_set_reactive (actor, TRUE);
will automatically result in the actor moving to follow the pointer whenever the pointer's button is pressed over the actor and moved across the stage.
<clutter-drag-action> will signal the begin and the end of a
dragging through the
signals, respectively. Each pointer motion during a drag will also
result in the
<"drag-motion"> signal to be emitted.
It is also possible to set another
<clutter-actor> as the dragged
actor by calling
clutter-drag-action-set-drag-handle from within
a handle of the
<"drag-begin"> signal. The drag handle must be
parented and exist between the emission of
The example program above allows dragging the rectangle around the stage
<clutter-drag-action>. When pressing the
"Shift") key the actor that is going to be dragged is a separate
rectangle, and when the drag ends, the original rectangle will be
animated to the final coordinates.
<clutter-drag-action> is available since Clutter 1.4
Creates a new
- the newly created
Sets the actor to be used as the drag handle.
<clutter-actor>, or ‘
#f’ to unset.
<clutter-drag-action>) ⇒ (ret
Retrieves the drag handle set by
<clutter-actor>, used as the drag handle, or ‘
#f’ if none was set.
Restricts the dragging action to a specific axis
- the axis to constraint the dragging to