Code

Fix constrained motion in the selector tool when snapping is being overridden (i...
authordvlierop2 <dvlierop2@users.sourceforge.net>
Tue, 21 Apr 2009 19:10:22 +0000 (19:10 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Tue, 21 Apr 2009 19:10:22 +0000 (19:10 +0000)
src/seltrans.cpp

index 816a471cf4386f8e12c98c87c95f1e0215dea98d..64f7d3cdcf526f602883d56e188d4a90d29311a1 100644 (file)
@@ -1400,7 +1400,15 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
        m.setup(_desktop, true, _items_const);
        m.freeSnapReturnByRef(SnapPreferences::SNAPPOINT_NODE, dxy, Inkscape::SNAPSOURCE_UNDEFINED);
 
-    } else if (!shift) {
+    } else if (shift) {
+       if (control) { // shift & control: constrained movement without snapping
+               if (fabs(dxy[Geom::X]) > fabs(dxy[Geom::Y])) {
+                               dxy[Geom::Y] = 0;
+                       } else {
+                               dxy[Geom::X] = 0;
+                       }
+       }
+    } else { //!shift: with snapping
 
         /* We're snapping to things, possibly with a constraint to horizontal or
         ** vertical movement.  Obtain a list of possible translations and then
@@ -1412,7 +1420,7 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
        /* This will be our list of possible translations */
         std::list<Inkscape::SnappedPoint> s;
 
-        if (control) {
+        if (control) { // constrained movement with snapping
 
             /* Snap to things, and also constrain to horizontal or vertical movement */
 
@@ -1433,7 +1441,7 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
                                                                                                         _point,
                                                                                                         Inkscape::Snapper::ConstraintLine(component_vectors[dim]),
                                                                                                         dxy));
-        } else {
+        } else { // !control
 
             // Let's leave this timer code here for a while. I'll probably need it in the near future (Diederik van Lierop)
             /* GTimeVal starttime;