From 84504bd815a6ef3c5b7b5958ce46429cbab56a66 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 3 Nov 2007 14:48:50 +0000 Subject: Groundwork to snap to intersections, e.g. intersections of gridlines with guidelines, and of objects with other objects. The snappers used to return only SnappedPoints, but now also SnappedLines and SnappedInfiniteLines can be returned. SnappedPaths will be implemented later. (bzr r4016) --- src/snapper.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src/snapper.cpp') diff --git a/src/snapper.cpp b/src/snapper.cpp index 17d7b7137..5edde2405 100644 --- a/src/snapper.cpp +++ b/src/snapper.cpp @@ -91,7 +91,9 @@ void Inkscape::Snapper::setEnabled(bool s) * \return Snapped point. */ -Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t, +void Inkscape::Snapper::freeSnap(SnappedConstraints &sc, + + PointType const &t, NR::Point const &p, bool const &first_point, std::vector &points_to_snap, @@ -99,7 +101,7 @@ Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t, { std::list lit; lit.push_back(it); - return freeSnap(t, p, first_point, points_to_snap, lit); + freeSnap(sc, t, p, first_point, points_to_snap, lit); } @@ -114,17 +116,19 @@ Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t, * \return Snapped point. */ -Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t, +void Inkscape::Snapper::freeSnap(SnappedConstraints &sc, + + PointType const &t, NR::Point const &p, bool const &first_point, std::vector &points_to_snap, std::list const &it) const { if (_enabled == false || getSnapFrom(t) == false) { - return SnappedPoint(p, NR_HUGE); + return; } - return _doFreeSnap(t, p, first_point, points_to_snap, it); + _doFreeSnap(sc, t, p, first_point, points_to_snap, it); } @@ -141,7 +145,9 @@ Inkscape::SnappedPoint Inkscape::Snapper::freeSnap(PointType const &t, * \return Snapped point. */ -Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t, +void Inkscape::Snapper::constrainedSnap(SnappedConstraints &sc, + + PointType const &t, NR::Point const &p, bool const &first_point, std::vector &points_to_snap, @@ -150,7 +156,7 @@ Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t, { std::list lit; lit.push_back(it); - return constrainedSnap(t, p, first_point, points_to_snap, c, lit); + constrainedSnap(sc, t, p, first_point, points_to_snap, c, lit); } @@ -165,7 +171,9 @@ Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t, * \return Snapped point. */ -Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t, +void Inkscape::Snapper::constrainedSnap(SnappedConstraints &sc, + + PointType const &t, NR::Point const &p, bool const &first_point, std::vector &points_to_snap, @@ -173,10 +181,10 @@ Inkscape::SnappedPoint Inkscape::Snapper::constrainedSnap(PointType const &t, std::list const &it) const { if (_enabled == false || getSnapFrom(t) == false) { - return SnappedPoint(p, NR_HUGE); + return; } - return _doConstrainedSnap(t, p, first_point, points_to_snap, c, it); + _doConstrainedSnap(sc, t, p, first_point, points_to_snap, c, it); } /* -- cgit v1.2.3