[gimp] Issue #1850 - Undoing the "straighten" operation in the Measure tool ...



commit 2e08c9164a91f8eb04a8a306b371dc4bb2cc5a40
Author: Ell <ell_se yahoo com>
Date:   Mon Jul 16 00:57:41 2018 -0400

    Issue #1850 - Undoing the "straighten" operation in the Measure tool ...
    
    ... does not restore the measure points
    
    Halt the measure tool after straightening, thus removing the
    expectation that undoing the operation should restore the original
    points.
    
    Halting the tool, rather than making undo work "as expected",
    sidesteps several issues:
    
      - Implementing undo correctly is tricky, since image-undo and
        tool-undo are handled separately.
    
      - In fact, the measure tool doesn't provide tool-undo, so that
        image edits can be undone while the tool is active without
        affecting the tool, and it's not clear that we want to change
        this behavior.  However, this makes undoing a straighten
        operation a special case, and it's not entirely clear what the
        behavior should be when undoing other kinds of transformations,
        or when the measure points had changed since the straighten
        operation.
    
      - Perhaps most importantly, measure tool points are restricted to
        the pixel grid, which means that when measuring an angle
        against an orientation that's not fully horizontal or vertical
        in image space (either using a 3-point angle, or when the
        canvas is rotated), the resulting transformed point after
        straightening doesn't generally land on the pixel grid, causing
        it to be rounded, which can result in a non-zero angle after
        the rotation.  This is especially ugly, since clicking
        "straighten" again at this point would cause another non-
        trivial rotation.

 app/tools/gimpmeasuretool.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)
---
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index 4788ae477a..c498aced13 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -852,24 +852,5 @@ gimp_measure_tool_straighten_button_clicked (GtkWidget       *button,
   GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (measure);
 
   if (gimp_transform_tool_transform (tr_tool, tool->display))
-    {
-      gdouble x0, y0;
-      gdouble x1, y1;
-
-      gimp_matrix3_transform_point (&tr_tool->transform,
-                                    measure->x[0],
-                                    measure->y[0],
-                                    &x0, &y0);
-      gimp_matrix3_transform_point (&tr_tool->transform,
-                                    measure->x[1],
-                                    measure->y[1],
-                                    &x1, &y1);
-
-      g_object_set (measure->widget,
-                    "x1", SIGNED_ROUND (x0),
-                    "y1", SIGNED_ROUND (y0),
-                    "x2", SIGNED_ROUND (x1),
-                    "y2", SIGNED_ROUND (y1),
-                    NULL);
-    }
+    gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]