From de27d953d1c13d2e7563b43c2d959b1b02aee9c3 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Mon, 12 May 2008 18:58:04 +0000 Subject: Add a centralized check (i.e. in the snapper mechanism) whether we've snapped or not, instead of leaving it up to the various tools. This should prevent these tools from moving to (0,0) if they bluntly use the value returned by the snapping mechanism without checking whether snapping has really occured. (bzr r5659) --- src/snap.h | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'src/snap.h') diff --git a/src/snap.h b/src/snap.h index f49eb7145..900f548ce 100644 --- a/src/snap.h +++ b/src/snap.h @@ -50,19 +50,33 @@ public: void setup(SPDesktop const *desktop_for_snapindicator = NULL, SPItem const *item_to_ignore = NULL, std::vector *unselected_nodes = NULL); void setup(SPDesktop const *desktop_for_snapindicator, std::vector &items_to_ignore, std::vector *unselected_nodes = NULL); + // freeSnapVoid() is preferred over freeSnap(), because it only returns a + // point, by overwriting p, if snapping has occured; otherwise p is untouched + void freeSnapVoid(Inkscape::Snapper::PointType point_type, + NR::Point &p, + bool first_point = true, + NR::Maybe const &bbox_to_snap = NR::Nothing()) const; + Inkscape::SnappedPoint freeSnap(Inkscape::Snapper::PointType point_type, NR::Point const &p, bool first_point = true, NR::Maybe const &bbox_to_snap = NR::Nothing()) const; - + + // constrainedSnapVoid() is preferred over constrainedSnap(), because it only returns a + // point, by overwriting p, if snapping has occured; otherwise p is untouched + void constrainedSnapVoid(Inkscape::Snapper::PointType point_type, + NR::Point &p, + Inkscape::Snapper::ConstraintLine const &constraint, + bool first_point = true, + NR::Maybe const &bbox_to_snap = NR::Nothing()) const; + Inkscape::SnappedPoint constrainedSnap(Inkscape::Snapper::PointType point_type, NR::Point const &p, Inkscape::Snapper::ConstraintLine const &constraint, bool first_point = true, NR::Maybe const &bbox_to_snap = NR::Nothing()) const; - Inkscape::SnappedPoint guideSnap(NR::Point const &p, - NR::Point const &guide_normal) const; + void guideSnap(NR::Point &p, NR::Point const &guide_normal) const; Inkscape::SnappedPoint freeSnapTranslation(Inkscape::Snapper::PointType point_type, std::vector const &p, @@ -84,18 +98,18 @@ public: NR::Point const &o) const; Inkscape::SnappedPoint constrainedSnapStretch(Inkscape::Snapper::PointType point_type, - std::vector const &p, - NR::Coord const &s, - NR::Point const &o, - NR::Dim2 d, - bool uniform) const; + std::vector const &p, + NR::Coord const &s, + NR::Point const &o, + NR::Dim2 d, + bool uniform) const; Inkscape::SnappedPoint constrainedSnapSkew(Inkscape::Snapper::PointType point_type, - std::vector const &p, - Inkscape::Snapper::ConstraintLine const &constraint, - NR::Point const &s, // s[0] = skew factor, s[1] = scale factor - NR::Point const &o, - NR::Dim2 d) const; + std::vector const &p, + Inkscape::Snapper::ConstraintLine const &constraint, + NR::Point const &s, // s[0] = skew factor, s[1] = scale factor + NR::Point const &o, + NR::Dim2 d) const; Inkscape::GuideSnapper guide; ///< guide snapper Inkscape::ObjectSnapper object; ///< snapper to other objects -- cgit v1.2.3