summaryrefslogtreecommitdiffstats
path: root/src/snap.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2011-09-18 17:09:29 +0000
committerDiederik van Lierop <mail@diedenrezi.nl>2011-09-18 17:09:29 +0000
commit344d9e8077c05b86e7d423b5db163b3e3e541032 (patch)
tree1734ecbec437e8d5d381989dc499d49fc656f859 /src/snap.cpp
parentGerman translation update (diff)
downloadinkscape-344d9e8077c05b86e7d423b5db163b3e3e541032.tar.gz
inkscape-344d9e8077c05b86e7d423b5db163b3e3e541032.zip
Snap to guide-path intersections, and don't snap to paths when only path intersections are asked for
Fixed bugs: - https://launchpad.net/bugs/847457 - https://launchpad.net/bugs/850982 (bzr r10639)
Diffstat (limited to 'src/snap.cpp')
-rw-r--r--src/snap.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/snap.cpp b/src/snap.cpp
index 631704b5c..eeca66d74 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -1168,19 +1168,13 @@ Inkscape::SnappedPoint SnapManager::findBestSnap(Inkscape::SnapCandidatePoint co
// search for the closest snapped curve
Inkscape::SnappedCurve closestCurve;
- if (getClosestCurve(isr.curves, closestCurve)) {
+ // We might have collected the paths only to snap to their intersection, without the intention to snap to the paths themselves
+ // Therefore we explicitly check whether the paths should be considered as snap targets themselves
+ bool exclude_paths = !snapprefs.isTargetSnappable(Inkscape::SNAPTARGET_PATH);
+ if (getClosestCurve(isr.curves, closestCurve, exclude_paths)) {
sp_list.push_back(Inkscape::SnappedPoint(closestCurve));
}
- if (snapprefs.isTargetSnappable(Inkscape::SNAPTARGET_PATH_INTERSECTION)) {
- // search for the closest snapped intersection of curves
- Inkscape::SnappedPoint closestCurvesIntersection;
- if (getClosestIntersectionCS(isr.curves, p.getPoint(), closestCurvesIntersection, _desktop->dt2doc())) {
- closestCurvesIntersection.setSource(p.getSourceType());
- sp_list.push_back(closestCurvesIntersection);
- }
- }
-
// search for the closest snapped grid line
Inkscape::SnappedLine closestGridLine;
if (getClosestSL(isr.grid_lines, closestGridLine)) {
@@ -1200,6 +1194,24 @@ Inkscape::SnappedPoint SnapManager::findBestSnap(Inkscape::SnapCandidatePoint co
// the grid/guide/path we're snapping to. This snappoint is therefore fully constrained, so there's
// no need to look for additional intersections
if (!constrained) {
+ if (snapprefs.isTargetSnappable(Inkscape::SNAPTARGET_PATH_INTERSECTION)) {
+ // search for the closest snapped intersection of curves
+ Inkscape::SnappedPoint closestCurvesIntersection;
+ if (getClosestIntersectionCS(isr.curves, p.getPoint(), closestCurvesIntersection, _desktop->dt2doc())) {
+ closestCurvesIntersection.setSource(p.getSourceType());
+ sp_list.push_back(closestCurvesIntersection);
+ }
+ }
+
+ if (snapprefs.isTargetSnappable(Inkscape::SNAPTARGET_PATH_GUIDE_INTERSECTION)) {
+ // search for the closest snapped intersection of a guide with a curve
+ Inkscape::SnappedPoint closestCurveGuideIntersection;
+ if (getClosestIntersectionCL(isr.curves, isr.guide_lines, p.getPoint(), closestCurveGuideIntersection, _desktop->dt2doc())) {
+ closestCurveGuideIntersection.setSource(p.getSourceType());
+ sp_list.push_back(closestCurveGuideIntersection);
+ }
+ }
+
// search for the closest snapped intersection of grid lines
Inkscape::SnappedPoint closestGridPoint;
if (getClosestIntersectionSL(isr.grid_lines, closestGridPoint)) {