app: Fix "Handle Transform" handle snap location
This commit is contained in:
@ -552,6 +552,7 @@ gimp_tool_handle_grid_button_press (GimpToolWidget *widget,
|
|||||||
GimpToolHandleGridPrivate *private = grid->private;
|
GimpToolHandleGridPrivate *private = grid->private;
|
||||||
gint n_handles = private->n_handles;
|
gint n_handles = private->n_handles;
|
||||||
gint active_handle = private->handle - 1;
|
gint active_handle = private->handle - 1;
|
||||||
|
GimpCanvasItem *dragged_handle = NULL;
|
||||||
|
|
||||||
switch (private->handle_mode)
|
switch (private->handle_mode)
|
||||||
{
|
{
|
||||||
@ -591,9 +592,23 @@ gimp_tool_handle_grid_button_press (GimpToolWidget *widget,
|
|||||||
|
|
||||||
g_object_notify (G_OBJECT (grid), "n-handles");
|
g_object_notify (G_OBJECT (grid), "n-handles");
|
||||||
}
|
}
|
||||||
|
else if (active_handle >= 0 &&
|
||||||
|
active_handle < 4)
|
||||||
|
{
|
||||||
|
/* existing handle is being dragged. don't set dragged_handle for
|
||||||
|
* newly-created handles, otherwise their snap offset will be wrong
|
||||||
|
*/
|
||||||
|
dragged_handle = private->handles[private->handle];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_HANDLE_MODE_MOVE:
|
case GIMP_HANDLE_MODE_MOVE:
|
||||||
|
if (active_handle >= 0 &&
|
||||||
|
active_handle < 4)
|
||||||
|
{
|
||||||
|
/* existing handle is being dragged */
|
||||||
|
dragged_handle = private->handles[private->handle];
|
||||||
|
}
|
||||||
/* check for valid position and calculating of OX0...OY3 is
|
/* check for valid position and calculating of OX0...OY3 is
|
||||||
* done on button release
|
* done on button release
|
||||||
*/
|
*/
|
||||||
@ -627,6 +642,22 @@ gimp_tool_handle_grid_button_press (GimpToolWidget *widget,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ensure dragged handles snap to guides based on the handle center, not where
|
||||||
|
* the cursor grabbed them
|
||||||
|
*/
|
||||||
|
if (dragged_handle)
|
||||||
|
{
|
||||||
|
gdouble x, y;
|
||||||
|
|
||||||
|
gimp_canvas_handle_get_position (dragged_handle,
|
||||||
|
&x,
|
||||||
|
&y);
|
||||||
|
gimp_tool_widget_set_snap_offsets (widget,
|
||||||
|
SIGNED_ROUND (x - coords->x),
|
||||||
|
SIGNED_ROUND (y - coords->y),
|
||||||
|
0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
private->last_x = coords->x;
|
private->last_x = coords->x;
|
||||||
private->last_y = coords->y;
|
private->last_y = coords->y;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user