Code

1) Fix moving by an integer multiple of the grid spacing (<alt>-dragging in the selec...
[inkscape.git] / src / seltrans.cpp
index 1c601b3ea254aa6302ed4302387e0b5f3cd0a956..7a08e0a7e6d1b3df29890f5d5e98330483355fef 100644 (file)
@@ -1439,13 +1439,17 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
 
     if (alt) {
 
-        /* Alt pressed means keep offset: snap the moved distance to the grid.
-        ** FIXME: this will snap to more than just the grid, nowadays.
-        */
+        // Alt pressed means: move only by integer multiples of the grid spacing
 
+        if (control) { // ... if also constrained to the orthogonal axes
+            if (fabs(dxy[Geom::X]) > fabs(dxy[Geom::Y])) {
+                dxy[Geom::Y] = 0;
+            } else {
+                dxy[Geom::X] = 0;
+            }
+        }
         m.setup(_desktop, true, _items_const);
-        m.freeSnapReturnByRef(dxy, Inkscape::SNAPSOURCE_UNDEFINED);
-
+        dxy = m.multipleOfGridPitch(dxy, _point);
     } else if (shift) {
         if (control) { // shift & control: constrained movement without snapping
             if (fabs(dxy[Geom::X]) > fabs(dxy[Geom::Y])) {