[gimp/gimp-2-8] Bug 722034 - Incorrect snapping behaviour for scale tool
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 722034 - Incorrect snapping behaviour for scale tool
- Date: Wed, 29 Jan 2014 22:45:50 +0000 (UTC)
commit aed3e3c741000ace5656030697cb0733c1c509ac
Author: Michael Natterer <mitch gimp org>
Date: Wed Jan 29 23:40:35 2014 +0100
Bug 722034 - Incorrect snapping behaviour for scale tool
Always snap to the center of transform tool handles.
(cherry picked from commit 5054241ca61dbdf869701b429a84d0c239a2d22a)
app/display/gimpcanvashandle.c | 15 +++++++++++++++
app/display/gimpcanvashandle.h | 4 ++++
app/tools/gimptransformtool.c | 18 ++++++++++++++++++
3 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/app/display/gimpcanvashandle.c b/app/display/gimpcanvashandle.c
index 45ad673..c776fb4 100644
--- a/app/display/gimpcanvashandle.c
+++ b/app/display/gimpcanvashandle.c
@@ -452,6 +452,21 @@ gimp_canvas_handle_new (GimpDisplayShell *shell,
}
void
+gimp_canvas_handle_get_position (GimpCanvasItem *handle,
+ gdouble *x,
+ gdouble *y)
+{
+ g_return_if_fail (GIMP_IS_CANVAS_HANDLE (handle));
+ g_return_if_fail (x != NULL);
+ g_return_if_fail (y != NULL);
+
+ g_object_get (handle,
+ "x", x,
+ "y", y,
+ NULL);
+}
+
+void
gimp_canvas_handle_set_position (GimpCanvasItem *handle,
gdouble x,
gdouble y)
diff --git a/app/display/gimpcanvashandle.h b/app/display/gimpcanvashandle.h
index 7dea56b..2aeae08 100644
--- a/app/display/gimpcanvashandle.h
+++ b/app/display/gimpcanvashandle.h
@@ -57,9 +57,13 @@ GimpCanvasItem * gimp_canvas_handle_new (GimpDisplayShell *shell,
gint width,
gint height);
+void gimp_canvas_handle_get_position (GimpCanvasItem *handle,
+ gdouble *x,
+ gdouble *y);
void gimp_canvas_handle_set_position (GimpCanvasItem *handle,
gdouble x,
gdouble y);
+
void gimp_canvas_handle_set_angles (GimpCanvasItem *handle,
gdouble start_handle,
gdouble slice_handle);
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 3df8f01..009659c 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -54,6 +54,7 @@
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpcanvasgroup.h"
+#include "display/gimpcanvashandle.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-transform.h"
@@ -341,6 +342,23 @@ gimp_transform_tool_button_press (GimpTool *tool,
tr_tool->prev_trans_info[i] = tr_tool->trans_info[i];
gimp_tool_control_activate (tool->control);
+
+ if (GIMP_IS_CANVAS_HANDLE (tr_tool->handles[tr_tool->function]))
+ {
+ gdouble x, y;
+
+ gimp_canvas_handle_get_position (tr_tool->handles[tr_tool->function],
+ &x, &y);
+
+ gimp_tool_control_set_snap_offsets (tool->control,
+ SIGNED_ROUND (x - coords->x),
+ SIGNED_ROUND (y - coords->y),
+ 0, 0);
+ }
+ else
+ {
+ gimp_tool_control_set_snap_offsets (tool->control, 0, 0, 0, 0);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]