Top | ![]() |
![]() |
![]() |
![]() |
double | acceleration-factor | Read / Write |
double | deceleration | Read / Write |
gboolean | interpolate | Read / Write |
ClutterPanAxis | pan-axis | Read / Write |
GObject ╰── GInitiallyUnowned ╰── ClutterActorMeta ╰── ClutterAction ╰── ClutterGestureAction ╰── ClutterPanAction
ClutterPanAction is a sub-class of ClutterGestureAction that implements the logic for recognizing pan gestures.
The simplest usage of ClutterPanAction consists in adding it to a ClutterActor with a child and setting it as reactive; for instance, the following code:
1 2 |
clutter_actor_add_action (actor, clutter_pan_action_new ()); clutter_actor_set_reactive (actor, TRUE); |
will automatically result in the actor children to be moved when dragging.
ClutterAction *
clutter_pan_action_new (void
);
Creates a new ClutterPanAction instance
Since: 1.12
void clutter_pan_action_set_pan_axis (ClutterPanAction *self
,ClutterPanAxis axis
);
Restricts the panning action to a specific axis
Since: 1.12
ClutterPanAxis
clutter_pan_action_get_pan_axis (ClutterPanAction *self
);
Retrieves the axis constraint set by clutter_pan_action_set_pan_axis()
Since: 1.12
void clutter_pan_action_set_interpolate (ClutterPanAction *self
,gboolean should_interpolate
);
Sets whether the action should emit interpolated ::pan events after the drag has ended, to emulate the gesture kinetic inertia.
Since: 1.12
gboolean
clutter_pan_action_get_interpolate (ClutterPanAction *self
);
Checks if the action should emit ::pan events even after releasing the pointer during a panning gesture, to emulate some kind of kinetic inertia.
Since: 1.12
void clutter_pan_action_set_deceleration (ClutterPanAction *self
,gdouble rate
);
Sets the deceleration rate of the interpolated ::pan events generated after a pan gesture. This is approximately the value that the momentum at the time of releasing the pointer is divided by every 60th of a second.
Since: 1.12
gdouble
clutter_pan_action_get_deceleration (ClutterPanAction *self
);
Retrieves the deceleration rate of interpolated ::pan events.
Since: 1.12
void clutter_pan_action_set_acceleration_factor (ClutterPanAction *self
,gdouble factor
);
Factor applied to the momentum velocity at the time of releasing the pointer when generating interpolated ::pan events.
Since: 1.12
gdouble
clutter_pan_action_get_acceleration_factor
(ClutterPanAction *self
);
Retrieves the initial acceleration factor for interpolated ::pan events.
Since: 1.12
void clutter_pan_action_get_interpolated_coords (ClutterPanAction *self
,gfloat *interpolated_x
,gfloat *interpolated_y
);
Retrieves the coordinates, in stage space, of the latest interpolated
event, analogous to clutter_gesture_action_get_motion_coords()
.
self |
||
interpolated_x |
return location for the latest interpolated event's X coordinate. |
[out][allow-none] |
interpolated_y |
return location for the latest interpolated event's Y coordinate. |
[out][allow-none] |
Since: 1.12
gfloat clutter_pan_action_get_interpolated_delta (ClutterPanAction *self
,gfloat *delta_x
,gfloat *delta_y
);
Retrieves the delta, in stage space, since the latest interpolated
event, analogous to clutter_gesture_action_get_motion_delta()
.
self |
||
delta_x |
return location for the X delta since the latest interpolated event. |
[out][allow-none] |
delta_y |
return location for the Y delta since the latest interpolated event. |
[out][allow-none] |
Since: 1.12
void clutter_pan_action_get_motion_coords (ClutterPanAction *self
,guint point
,gfloat *motion_x
,gfloat *motion_y
);
Retrieves the coordinates, in stage space, dependent on the current state
of the ClutterPanAction. If it is inactive, both fields will be
set to 0. If it is panning by user action, the values will be equivalent
to those returned by clutter_gesture_action_get_motion_coords()
.
If it is interpolating with some form of kinetic scrolling, the values
will be equivalent to those returned by
clutter_pan_action_get_interpolated_coords()
. This is a convenience
method designed to be used in replacement "pan" signal handlers.
self |
||
point |
the touch point index, with 0 being the first touch point received by the action |
|
motion_x |
return location for the X coordinate. |
[out][allow-none] |
motion_y |
return location for the Y coordinate. |
[out][allow-none] |
Since: 1.14
gfloat clutter_pan_action_get_motion_delta (ClutterPanAction *self
,guint point
,gfloat *delta_x
,gfloat *delta_y
);
Retrieves the delta, in stage space, dependent on the current state
of the ClutterPanAction. If it is inactive, both fields will be
set to 0. If it is panning by user action, the values will be equivalent
to those returned by clutter_gesture_action_get_motion_delta()
.
If it is interpolating with some form of kinetic scrolling, the values
will be equivalent to those returned by
clutter_pan_action_get_interpolated_delta()
. This is a convenience
method designed to be used in replacement "pan" signal handlers.
self |
||
point |
the touch point index, with 0 being the first touch point received by the action |
|
delta_x |
return location for the X delta. |
[out][allow-none] |
delta_y |
return location for the Y delta. |
[out][allow-none] |
Since: 1.14
gfloat clutter_pan_action_get_constrained_motion_delta (ClutterPanAction *self
,guint point
,gfloat *delta_x
,gfloat *delta_y
);
Retrieves the delta, in stage space, dependent on the current state of the ClutterPanAction, and respecting the constraint specified by the “pan-axis” property.
self |
||
point |
the touch point index, with 0 being the first touch point received by the action |
|
delta_x |
return location for the X delta. |
[out][optional] |
delta_y |
return location for the Y delta. |
[out][optional] |
Since: 1.24
struct ClutterPanAction;
The ClutterPanAction structure contains only private data and should be accessed using the provided API
Since: 1.12
struct ClutterPanActionClass { gboolean (* pan) (ClutterPanAction *action, ClutterActor *actor, gboolean is_interpolated); void (* pan_stopped) (ClutterPanAction *action, ClutterActor *actor); };
The ClutterPanActionClass structure contains only private data.
Since: 1.12
The axis of the constraint that should be applied on the panning action
Since: 1.12
“acceleration-factor”
property “acceleration-factor” double
The initial acceleration factor
The kinetic momentum measured at the time of releasing the pointer will be multiplied by the factor specified by this property before being used to generate interpolated ::pan events.
Owner: ClutterPanAction
Flags: Read / Write
Allowed values: >= 1
Default value: 1
Since: 1.12
“deceleration”
property “deceleration” double
The rate at which the interpolated panning will decelerate in
ClutterPanAction will emit interpolated ::pan events with decreasing scroll deltas, using the rate specified by this property.
Owner: ClutterPanAction
Flags: Read / Write
Allowed values: [1e-15,1]
Default value: 0.95
Since: 1.12
“interpolate”
property“interpolate” gboolean
Whether interpolated events emission is enabled.
Owner: ClutterPanAction
Flags: Read / Write
Default value: FALSE
Since: 1.12
“pan-axis”
property“pan-axis” ClutterPanAxis
Constraints the panning action to the specified axis
Owner: ClutterPanAction
Flags: Read / Write
Default value: CLUTTER_PAN_AXIS_NONE
Since: 1.12
“pan”
signalgboolean user_function (ClutterPanAction *action, ClutterActor *actor, gboolean is_interpolated, gpointer user_data)
The ::pan signal is emitted to keep track of the motion during
a pan gesture. is_interpolated
is set to TRUE
during the
interpolation phase of the pan, after the drag has ended and
the :interpolate property was set to TRUE
.
action |
the ClutterPanAction that emitted the signal |
|
actor |
the ClutterActor attached to the |
|
is_interpolated |
if the event is the result of interpolating the motion velocity at the end of the drag |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.12
“pan-stopped”
signalvoid user_function (ClutterPanAction *action, ClutterActor *actor, gpointer user_data)
The ::pan-stopped signal is emitted at the end of the interpolation
phase of the pan action, only when :interpolate is set to TRUE
.
action |
the ClutterPanAction that emitted the signal |
|
actor |
the ClutterActor attached to the |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.12