pan-action: emit ::pan-stopped before ::gesture-begin
When starting a new gesture before the momentum of the previous one has finished the ::pan-stopped was counter-intuitively emitted after the new ::gesture-begin. Make use of gesture_prepare() to reset the state of the action right before emitting ::gesture-begin. https://bugzilla.gnome.org/show_bug.cgi?id=683431
This commit is contained in:
parent
2001cd7a2c
commit
3b298ddfa3
@ -188,8 +188,8 @@ on_deceleration_new_frame (ClutterTimeline *timeline,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gesture_begin (ClutterGestureAction *gesture,
|
||||
ClutterActor *actor)
|
||||
gesture_prepare (ClutterGestureAction *gesture,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture);
|
||||
ClutterPanActionPrivate *priv = self->priv;
|
||||
@ -197,6 +197,16 @@ gesture_begin (ClutterGestureAction *gesture,
|
||||
if (priv->state == PAN_STATE_INTERPOLATING && priv->deceleration_timeline)
|
||||
clutter_timeline_stop (priv->deceleration_timeline);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gesture_begin (ClutterGestureAction *gesture,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterPanAction *self = CLUTTER_PAN_ACTION (gesture);
|
||||
ClutterPanActionPrivate *priv = self->priv;
|
||||
|
||||
priv->state = PAN_STATE_PANNING;
|
||||
priv->interpolated_x = priv->interpolated_y = 0.0f;
|
||||
priv->dx = priv->dy = 0.0f;
|
||||
@ -421,6 +431,7 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass)
|
||||
|
||||
klass->pan = clutter_pan_action_real_pan;
|
||||
|
||||
gesture_class->gesture_prepare = gesture_prepare;
|
||||
gesture_class->gesture_begin = gesture_begin;
|
||||
gesture_class->gesture_progress = gesture_progress;
|
||||
gesture_class->gesture_cancel = gesture_cancel;
|
||||
|
Loading…
Reference in New Issue
Block a user