[gimp] Bug 706275 - "View/Snap to active path" doesn't snap to layer center...



commit a0a7e713b44e9876fcd7a79bc82c131fd69580d6
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 17 22:12:44 2014 +0200

    Bug 706275 - "View/Snap to active path" doesn't snap to layer center...
    
    ...with the Move tool
    
    Add the missing code to snap to the rectangle's center in
    gimp_image_snap_rectangle().

 app/core/gimpimage-snap.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpimage-snap.c b/app/core/gimpimage-snap.c
index ee78a49..c651895 100644
--- a/app/core/gimpimage-snap.c
+++ b/app/core/gimpimage-snap.c
@@ -646,6 +646,34 @@ gimp_image_snap_rectangle (GimpImage *image,
                   snapped = TRUE;
                 }
             }
+
+          /*  center  */
+
+          coords1.x = x_center;
+          coords1.y = y_center;
+
+          if (gimp_stroke_nearest_point_get (stroke, &coords1, 1.0,
+                                             &nearest,
+                                             NULL, NULL, NULL) >= 0)
+            {
+              if (gimp_image_snap_distance (x_center, nearest.x,
+                                            epsilon_x,
+                                            &mindist_x, &nx))
+                {
+                  mindist_x = ABS (nx - x_center);
+                  *tx1 = RINT (x1 + (nx - x_center));
+                  snapped = TRUE;
+                }
+
+              if (gimp_image_snap_distance (y_center, nearest.y,
+                                            epsilon_y,
+                                            &mindist_y, &ny))
+                {
+                  mindist_y = ABS (ny - y_center);
+                  *ty1 = RINT (y1 + (ny - y_center));
+                  snapped = TRUE;
+               }
+            }
         }
     }
 


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