Bug 722034 - Incorrect snapping behaviour for scale tool

Always snap to the center of transform tool handles.
This commit is contained in:
Michael Natterer
2014-01-29 23:40:35 +01:00
parent 219bf35299
commit 5054241ca6
3 changed files with 37 additions and 0 deletions

View File

@ -493,6 +493,21 @@ gimp_canvas_handle_new (GimpDisplayShell *shell,
NULL);
}
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,

View File

@ -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);

View File

@ -52,6 +52,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"
@ -378,6 +379,23 @@ gimp_transform_tool_button_press (GimpTool *tool,
tr_tool->lasty = tr_tool->mousey = coords->y;
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);
}
}
void