[gtk+/gestures: 130/173] rotate: Ensure delta is betwee n [0..2π]
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gestures: 130/173] rotate: Ensure delta is betwee n [0..2π]
- Date: Fri, 16 May 2014 17:11:19 +0000 (UTC)
commit cf0d7ad4cfb24d79f9619a8ed66fdccb418f6831
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue May 6 11:43:31 2014 +0200
rotate: Ensure delta is between [0..2π]
gtk/gtkgesturerotate.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkgesturerotate.c b/gtk/gtkgesturerotate.c
index 9521298..ec8b12a 100644
--- a/gtk/gtkgesturerotate.c
+++ b/gtk/gtkgesturerotate.c
@@ -110,15 +110,18 @@ static gboolean
_gtk_gesture_rotate_check_emit (GtkGestureRotate *gesture)
{
GtkGestureRotatePrivate *priv;
- gdouble angle;
+ gdouble angle, delta;
if (!_gtk_gesture_rotate_get_angle (gesture, &angle))
return FALSE;
priv = gtk_gesture_rotate_get_instance_private (gesture);
+ delta = angle - priv->initial_angle;
+
+ if (delta < 0)
+ delta += 2 * G_PI;
- g_signal_emit (gesture, signals[ANGLE_CHANGED], 0,
- angle, angle - priv->initial_angle);
+ g_signal_emit (gesture, signals[ANGLE_CHANGED], 0, angle, delta);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]