Code

More sensitive selection of snap target when snapping guides to objects with multiple...
[inkscape.git] / src / object-snapper.cpp
index e0506c8e2a63509d136da6500694b599e34cb5f5..0ec1a7ba51992c28803a8b3ede7e57bb26bb67bd 100644 (file)
@@ -297,7 +297,6 @@ void Inkscape::ObjectSnapper::_snapTranslatingGuideToNodes(SnappedConstraints &s
     _collectNodes(t, true);
 
     SnappedPoint s;
-    bool success = false;
 
     Geom::Coord tol = getSnapperTolerance();
 
@@ -306,15 +305,12 @@ void Inkscape::ObjectSnapper::_snapTranslatingGuideToNodes(SnappedConstraints &s
         Geom::Point p_proj = Geom::projection((*k).first, Geom::Line(p, p + Geom::rot90(guide_normal)));
         Geom::Coord dist = Geom::L2((*k).first - p_proj); // distance from node to the guide
         Geom::Coord dist2 = Geom::L2(p - p_proj); // distance from projection of node on the guide, to the mouse location
-        if ((dist < tol && dist2 < tol) || (getSnapperAlwaysSnap() && dist < s.getSnapDistance())) {
+        std::cout << "d1 = " << dist << " | d2 = " << dist2 << " | tol = " << tol << std::endl;
+        if ((dist < tol && dist2 < tol) || getSnapperAlwaysSnap()) {
             s = SnappedPoint((*k).first, SNAPSOURCE_GUIDE, static_cast<Inkscape::SnapTargetType>((*k).second), dist, tol, getSnapperAlwaysSnap(), true);
-            success = true;
+            sc.points.push_back(s);
         }
     }
-
-    if (success) {
-        sc.points.push_back(s);
-    }
 }