From 50e11282e1144f17f54bd1c4cbfa55ecb6e7f0ed Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 31 Jan 2010 01:46:57 +0100 Subject: Fix constrained snapping in node tool. (bzr r9035) --- src/ui/tool/node.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index f2bec1f5f..2675b4045 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -872,6 +872,7 @@ void Node::_draggedHandler(Geom::Point &new_pos, GdkEventMotion *event) if (held_control(*event)) { Geom::Point origin = _last_drag_origin(); + Inkscape::SnappedPoint fp, bp; if (held_alt(*event)) { // with Ctrl+Alt, constrain to handle lines // project the new position onto a handle line that is closer @@ -880,10 +881,10 @@ void Node::_draggedHandler(Geom::Point &new_pos, GdkEventMotion *event) // TODO: combine these two branches by modifying snap.h / snap.cpp if (snap) { - Inkscape::SnappedPoint fp, bp; fp = sm.constrainedSnap(Inkscape::SnapCandidatePoint(position(), _snapSourceType()), line_front); bp = sm.constrainedSnap(Inkscape::SnapCandidatePoint(position(), _snapSourceType()), line_back); - + } + if (fp.getSnapped() || bp.getSnapped()) { if (fp.isOtherSnapBetter(bp, false)) { bp.getPoint(new_pos); } else { @@ -902,12 +903,12 @@ void Node::_draggedHandler(Geom::Point &new_pos, GdkEventMotion *event) // with Ctrl, constrain to axes // TODO combine the two branches if (snap) { - Inkscape::SnappedPoint fp, bp; Inkscape::Snapper::ConstraintLine line_x(origin, Geom::Point(1, 0)); Inkscape::Snapper::ConstraintLine line_y(origin, Geom::Point(0, 1)); fp = sm.constrainedSnap(Inkscape::SnapCandidatePoint(position(), _snapSourceType()), line_x); bp = sm.constrainedSnap(Inkscape::SnapCandidatePoint(position(), _snapSourceType()), line_y); - + } + if (fp.getSnapped() || bp.getSnapped()) { if (fp.isOtherSnapBetter(bp, false)) { fp = bp; } -- cgit v1.2.3