app: take transform-grid handle size into account when readjusting

In the unified-transform, scale, and perspective tools, take the
maximal transform-grid handle size into account when readjusting
the transform, so that the handles themselves are fully within view
under arbitrary rotation, rather than just the corners.
This commit is contained in:
Ell 2019-03-08 08:30:11 -05:00
parent f6bfc2f23b
commit 46e16e175c
4 changed files with 14 additions and 3 deletions

View File

@ -22,9 +22,14 @@
#define __GIMP_TOOL_TRANSFORM_GRID_H__
#include "gimpcanvashandle.h"
#include "gimptoolwidget.h"
#define GIMP_TOOL_TRANSFORM_GRID_MAX_HANDLE_SIZE \
(1.5 * GIMP_CANVAS_HANDLE_SIZE_LARGE)
typedef enum
{
GIMP_TRANSFORM_HANDLE_NONE,

View File

@ -176,7 +176,9 @@ gimp_perspective_tool_readjust (GimpTransformGridTool *tg_tool)
x = shell->disp_width / 2.0;
y = shell->disp_height / 2.0;
r = MIN (x, y) / G_SQRT2;
r = MAX (MIN (x, y) / G_SQRT2 -
GIMP_TOOL_TRANSFORM_GRID_MAX_HANDLE_SIZE / 2.0,
GIMP_TOOL_TRANSFORM_GRID_MAX_HANDLE_SIZE / 2.0);
gimp_display_shell_untransform_xy_f (shell,
x - r, y - r,

View File

@ -268,7 +268,9 @@ gimp_scale_tool_readjust (GimpTransformGridTool *tg_tool)
x = shell->disp_width / 2.0;
y = shell->disp_height / 2.0;
r = MIN (x, y) / G_SQRT2;
r = MAX (MIN (x, y) / G_SQRT2 -
GIMP_TOOL_TRANSFORM_GRID_MAX_HANDLE_SIZE / 2.0,
GIMP_TOOL_TRANSFORM_GRID_MAX_HANDLE_SIZE / 2.0);
gimp_display_shell_untransform_xy_f (shell,
x, y,

View File

@ -188,7 +188,9 @@ gimp_unified_transform_tool_readjust (GimpTransformGridTool *tg_tool)
x = shell->disp_width / 2.0;
y = shell->disp_height / 2.0;
r = MIN (x, y) / G_SQRT2;
r = MAX (MIN (x, y) / G_SQRT2 -
GIMP_TOOL_TRANSFORM_GRID_MAX_HANDLE_SIZE / 2.0,
GIMP_TOOL_TRANSFORM_GRID_MAX_HANDLE_SIZE / 2.0);
gimp_display_shell_untransform_xy_f (shell,
x, y,