Code

Implement snapping of gradient stops
authorDiederik van Lierop <mailat-signdiedenrezidotnl>
Sun, 14 Feb 2010 13:13:56 +0000 (14:13 +0100)
committerDiederik van Lierop <mailat-signdiedenrezidotnl>
Sun, 14 Feb 2010 13:13:56 +0000 (14:13 +0100)
src/gradient-drag.cpp

index 5be435a647764a0529d1f1c1b27bc65763833e80..0b9068b37343d49855e31c961c2ee7bafe3b728d 100644 (file)
@@ -807,6 +807,12 @@ gr_knot_moved_midpoint_handler(SPKnot */*knot*/, Geom::Point const &ppointer, gu
         p = snap_vector_midpoint (p, low_lim, high_lim, snap_fraction);
     } else {
         p = snap_vector_midpoint (p, low_lim, high_lim, 0);
+        if (!(state & GDK_SHIFT_MASK)) {
+            SPDesktop *desktop = dragger->parent->desktop;
+            SnapManager &m = desktop->namedview->snap_manager;
+            Inkscape::Snapper::ConstraintLine cl(low_lim, high_lim - low_lim);
+            m.constrainedSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE, cl);
+        }
     }
     Geom::Point displacement = p - dragger->point;