[gtk+/wip/baedert/gtkimageview: 165/215] GtkImageView: Don't reset scale/angle to 0



commit b77e6efe7bdb651503f5d08b575d8bd285239440
Author: Timm Bäder <mail baedert org>
Date:   Sat Jan 23 12:01:04 2016 +0100

    GtkImageView: Don't reset scale/angle to 0
    
    We are setting the gesture_foo_start_foo values in the changed
    callbacks, not the begin ones.

 gtk/gtkimageview.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkimageview.c b/gtk/gtkimageview.c
index 60ced04..baa1a83 100644
--- a/gtk/gtkimageview.c
+++ b/gtk/gtkimageview.c
@@ -545,7 +545,8 @@ gesture_zoom_cancel_cb (GtkGesture       *gesture,
 {
   GtkImageViewPrivate *priv = gtk_image_view_get_instance_private (user_data);
 
-  gtk_image_view_set_scale (user_data, priv->gesture_start_scale);
+  if (priv->in_zoom)
+    gtk_image_view_set_scale (user_data, priv->gesture_start_scale);
 
   priv->gesture_start_scale = 0.0;
   priv->in_zoom = FALSE;
@@ -633,7 +634,10 @@ gesture_rotate_cancel_cb (GtkGesture       *gesture,
                           gpointer          user_data)
 {
   GtkImageViewPrivate *priv = gtk_image_view_get_instance_private (user_data);
-  gtk_image_view_set_angle (user_data, priv->gesture_start_angle);
+
+  if (priv->in_rotate)
+    gtk_image_view_set_angle (user_data, priv->gesture_start_angle);
+
   priv->in_rotate = FALSE;
   priv->gesture_start_angle = 0.0;
 
@@ -1111,7 +1115,7 @@ gtk_image_view_set_scale (GtkImageView *image_view,
   double pointer_y;
 
   g_return_if_fail (GTK_IS_IMAGE_VIEW (image_view));
-  g_return_if_fail (scale >= 0.0);
+  g_return_if_fail (scale > 0.0);
 
   pointer_x = gtk_widget_get_allocated_width (GTK_WIDGET (image_view))  / 2;
   pointer_y = gtk_widget_get_allocated_height (GTK_WIDGET (image_view)) / 2;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]