From a9dfa726d6219fc0451d7b16a899ea199d8b5998 Mon Sep 17 00:00:00 2001 From: dvlierop2 Date: Mon, 21 Jul 2008 21:28:17 +0000 Subject: [PATCH] Disable snapping when holding the shift-key while dragging node-handles --- src/nodepath.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 023f931f2..387cf1b0a 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -3702,7 +3702,7 @@ static void node_handle_ungrabbed(SPKnot *knot, guint state, gpointer data) /** * Node handle "request" signal callback. */ -static gboolean node_handle_request(SPKnot *knot, NR::Point *p, guint /*state*/, gpointer data) +static gboolean node_handle_request(SPKnot *knot, NR::Point *p, guint state, gpointer data) { Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) data; @@ -3725,7 +3725,13 @@ static gboolean node_handle_request(SPKnot *knot, NR::Point *p, guint /*state*/, SPDesktop *desktop = n->subpath->nodepath->desktop; SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, n->subpath->nodepath->item); - Inkscape::SnappedPoint s ; + Inkscape::SnappedPoint s; + + if ((state & GDK_SHIFT_MASK) != 0) { + // We will not try to snap when the shift-key is pressed + // so remove the old snap indicator and don't wait for it to time-out + desktop->snapindicator->remove_snappoint(); + } Inkscape::NodePath::Node *othernode = opposite->other; if (othernode) { @@ -3740,12 +3746,18 @@ static gboolean node_handle_request(SPKnot *knot, NR::Point *p, guint /*state*/, NR::Coord const scal = dot(delta, ndelta) / linelen; (*p) = n->pos + (scal / linelen) * ndelta; } - s = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p, Inkscape::Snapper::ConstraintLine(*p, ndelta)); + if ((state & GDK_SHIFT_MASK) == 0) { + s = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p, Inkscape::Snapper::ConstraintLine(*p, ndelta)); + } } else { - s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p); + if ((state & GDK_SHIFT_MASK) == 0) { + s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p); + } } } else { - s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p); + if ((state & GDK_SHIFT_MASK) == 0) { + s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p); + } } s.getPoint(*p); -- 2.30.2