forked from AuroraMiddleware/gtk
rotate: Ensure delta is between [0..2π]
This commit is contained in:
parent
c34280d97b
commit
4589f0e0c8
@ -110,15 +110,18 @@ static gboolean
|
|||||||
_gtk_gesture_rotate_check_emit (GtkGestureRotate *gesture)
|
_gtk_gesture_rotate_check_emit (GtkGestureRotate *gesture)
|
||||||
{
|
{
|
||||||
GtkGestureRotatePrivate *priv;
|
GtkGestureRotatePrivate *priv;
|
||||||
gdouble angle;
|
gdouble angle, delta;
|
||||||
|
|
||||||
if (!_gtk_gesture_rotate_get_angle (gesture, &angle))
|
if (!_gtk_gesture_rotate_get_angle (gesture, &angle))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
priv = gtk_gesture_rotate_get_instance_private (gesture);
|
priv = gtk_gesture_rotate_get_instance_private (gesture);
|
||||||
|
delta = angle - priv->initial_angle;
|
||||||
|
|
||||||
g_signal_emit (gesture, signals[ANGLE_CHANGED], 0,
|
if (delta < 0)
|
||||||
angle, angle - priv->initial_angle);
|
delta += 2 * G_PI;
|
||||||
|
|
||||||
|
g_signal_emit (gesture, signals[ANGLE_CHANGED], 0, angle, delta);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user