[gimp/soc-2012-unified-transformation: 49/52] transformtool: Fix snapping of pivot, shell_transform also adds offset which is not helpful here, so



commit f6ebc5302a8220ed855c82308645a872c7b0ffc1
Author: Mikael Magnusson <mikachu src gnome org>
Date:   Wed Aug 15 01:29:18 2012 +0200

    transformtool: Fix snapping of pivot, shell_transform also adds offset which is not helpful here, so use the scale directly

 app/tools/gimpunifiedtransformtool.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/app/tools/gimpunifiedtransformtool.c b/app/tools/gimpunifiedtransformtool.c
index e0b6cdf..d15e8e9 100644
--- a/app/tools/gimpunifiedtransformtool.c
+++ b/app/tools/gimpunifiedtransformtool.c
@@ -210,7 +210,7 @@ gimp_unified_transform_tool_draw_gui (GimpTransformTool *tr_tool,
         gimp_draw_tool_add_handle (draw_tool,
                                    GIMP_HANDLE_SQUARE,
                                    tx[i], ty[i],
-                                   handle_w * 2, handle_h * 2,
+                                   handle_w * 1.5, handle_h * 1.5,
                                    GIMP_HANDLE_ANCHOR_CENTER);
 
       /*  draw the perspective handles  */
@@ -218,7 +218,7 @@ gimp_unified_transform_tool_draw_gui (GimpTransformTool *tr_tool,
         gimp_draw_tool_add_handle (draw_tool,
                                    GIMP_HANDLE_SQUARE,
                                    tx[i], ty[i],
-                                   handle_w, handle_h,
+                                   handle_w * 0.8, handle_h * 0.8,
                                    GIMP_HANDLE_ANCHOR_CENTER);
     }
 
@@ -620,7 +620,7 @@ gimp_unified_transform_tool_motion (GimpTransformTool *transform_tool)
   /* move rotation axis */
   if (function == TRANSFORM_HANDLE_PIVOT)
     {
-      gint screenx, screeny;
+      pivot = vectoradd (pivot, d);
 
       if (options->cornersnap)
         {
@@ -629,25 +629,18 @@ gimp_unified_transform_tool_motion (GimpTransformTool *transform_tool)
           gdouble closest_dist = G_MAXDOUBLE, dist;
           for (i = 0; i < 5; i++)
             {
-              dist = norm (vectorsubtract (cur, oldpos[i]));
+              dist = norm (vectorsubtract (pivot, oldpos[i]));
               if (dist < closest_dist)
                 {
                   closest_dist = dist;
                   closest = i;
                 }
             }
-          // TODO this seems to almost work right
-          gimp_display_shell_untransform_xy (gimp_display_get_shell (GIMP_TOOL (transform_tool)->display),
-                                             closest_dist, 0, &screenx, &screeny, TRUE);
-          if (screenx < 25)
+          if (closest_dist * gimp_display_get_shell (GIMP_TOOL (transform_tool)->display)->scale_x < 50)
             {
-              *newpivot_x = oldpos[closest].x;
-              *newpivot_y = oldpos[closest].y;
-
-              return;
+              pivot = oldpos[closest];
             }
         }
-      pivot = vectoradd (pivot, d);
 
       fixedpivot = TRUE;
     }



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