[gimp/7fc822786fbb905674d5d4fd9493ffda1e6b45b9: 1/2] Bug 706275 - "View/Snap to active path" doesn't snap to layer center...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/7fc822786fbb905674d5d4fd9493ffda1e6b45b9: 1/2] Bug 706275 - "View/Snap to active path" doesn't snap to layer center...
- Date: Sun, 17 Aug 2014 20:21:01 +0000 (UTC)
commit 7fc822786fbb905674d5d4fd9493ffda1e6b45b9
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().
(cherry picked from commit a0a7e713b44e9876fcd7a79bc82c131fd69580d6)
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 f553693..969bdf8 100644
--- a/app/core/gimpimage-snap.c
+++ b/app/core/gimpimage-snap.c
@@ -654,6 +654,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]