[gimp/soc-2012-unified-transformation: 21/21] transformtool: nonworking fromcenter for corner scale



commit 42c366297e449db2d0d3b165e7ffa93fef5aa651
Author: Mikael Magnusson <mikachu src gnome org>
Date:   Sat Jun 16 12:28:05 2012 +0200

    transformtool: nonworking fromcenter for corner scale

 app/tools/gimpunifiedtransformationtool.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/app/tools/gimpunifiedtransformationtool.c b/app/tools/gimpunifiedtransformationtool.c
index fb36d53..c018689 100644
--- a/app/tools/gimpunifiedtransformationtool.c
+++ b/app/tools/gimpunifiedtransformationtool.c
@@ -890,13 +890,13 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
       return;
     }
 
+  /* scaling via corner */
   if (function == TRANSFORM_HANDLE_NW ||
       function == TRANSFORM_HANDLE_NE ||
       function == TRANSFORM_HANDLE_SE ||
       function == TRANSFORM_HANDLE_SW)
     {
-      //TODO: scale through corner
-      /* Scaling through scale handles means translating one corner points,
+      /* Scaling through scale handles means translating one corner point,
        * with all sides at constant angles. */
 
       gint this, left, right, opposite;
@@ -929,6 +929,17 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
           p = vectorproject(p, diag);
         }
 
+      /* when the from centre transformation constraint is enabled, the
+       * translation shall also translate the diagonally opposite corner
+       * points by the same distance, however with the angle of the
+       * vector 180 degrees rotated. */
+      if (fromcenter)
+        {
+          op = vectorsubtract(op, p);
+
+          //TODO: and something smart
+        }
+
       /* Move the corner being interacted with */
       /*    rp---------tp
        *   /           /\ <- p, the interaction vector
@@ -975,6 +986,9 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
 
       *x[left] = nl.x;
       *y[left] = nl.y;
+
+      *x[opposite] = op.x;
+      *y[opposite] = op.y;
       /*
        *
        *  /--------------/
@@ -982,12 +996,6 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
        *
        */
 
-      /* when the from centre transformation constraint is enabled, the
-       * translation shall also translate the diagonally opposite corner
-       * points by the same distance, however with the angle of the
-       * vector 180 degrees rotated. */
-      if (fromcenter) {}
-
       return;
     }
 



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