summaryrefslogtreecommitdiffstats
path: root/src/snapped-point.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2009-03-07 20:47:00 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2009-03-07 20:47:00 +0000
commit86f80d1c9bd6cc3716c049da3d8c94887211648e (patch)
treebed9547bd809863fa7c66af9ec1f1c654f1f8b54 /src/snapped-point.cpp
parentSnap indicators and filters, mainly... (diff)
downloadinkscape-86f80d1c9bd6cc3716c049da3d8c94887211648e.tar.gz
inkscape-86f80d1c9bd6cc3716c049da3d8c94887211648e.zip
- When finalizing a curve by double clicking then don't snap to the curve itself
- When a node and an intersection coincide then snap to the node, not the intersection (but only if snapping is turned on for both of them of course) (bzr r7438)
Diffstat (limited to 'src/snapped-point.cpp')
-rw-r--r--src/snapped-point.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp
index d7f13d82f..7e9a16a66 100644
--- a/src/snapped-point.cpp
+++ b/src/snapped-point.cpp
@@ -126,13 +126,20 @@ bool Inkscape::SnappedPoint::isOtherSnapBetter(Inkscape::SnappedPoint const &oth
bool c3 = other_one.getFullyConstrained() && !getFullyConstrained();
// But in no case fall back; (has less priority than c3n, so it is allowed to fall back when c3 is true, see below)
bool c3n = !other_one.getFullyConstrained() && getFullyConstrained();
+
+ // When both are fully constrained AND coincident, then prefer nodes over intersections
+ bool d = other_one.getFullyConstrained() && getFullyConstrained() && (Geom::L2(other_one.getPoint() - getPoint()) < 1e-9);
+ bool c4 = d && !other_one.getAtIntersection() && getAtIntersection();
+ // But don't fall back...
+ bool c4n = d && other_one.getAtIntersection() && !getAtIntersection();
+
// or, if it's just as close then consider the second distance
- bool c4a = (dist_other == dist_this);
- bool c4b = other_one.getSecondSnapDistance() < getSecondSnapDistance();
+ bool c5a = (dist_other == dist_this);
+ bool c5b = other_one.getSecondSnapDistance() < getSecondSnapDistance();
- // std::cout << other_one.getPoint() << " (Other one) vs. " << getPoint() << " (this one) ---> ";
- // std::cout << "c1 = " << c1 << " | c2 = " << c2 << " | c2n = " << c2n << " | c3 = " << c3 << " | c3n = " << c3n << " | c4a = " << c4a << " | c4b = " << c4b << std::endl;
- return (c1 || c2 || c3 || (c4a && c4b)) && !c2n && (!c3n || c2);
+ // std::cout << other_one.getPoint() << " (Other one, dist = " << dist_other << ") vs. " << getPoint() << " (this one, dist = " << dist_this << ") ---> ";
+ // std::cout << "c1 = " << c1 << " | c2 = " << c2 << " | c2n = " << c2n << " | c3 = " << c3 << " | c3n = " << c3n << " | c4 = " << c4 << " | c4n = " << c4n << " | c5a = " << c5a << " | c5b = " << c5b << std::endl;
+ return (c1 || c2 || c3 || c4 || (c5a && c5b)) && !c2n && (!c3n || c2) && !c4n;
}
/*