summaryrefslogtreecommitdiffstats
path: root/src/snap.h
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2008-05-12 18:58:04 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2008-05-12 18:58:04 +0000
commitde27d953d1c13d2e7563b43c2d959b1b02aee9c3 (patch)
treeefc8ed7eaba9a2b0ed87eaf14b797103bd8fa33a /src/snap.h
parentfix typo (diff)
downloadinkscape-de27d953d1c13d2e7563b43c2d959b1b02aee9c3.tar.gz
inkscape-de27d953d1c13d2e7563b43c2d959b1b02aee9c3.zip
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)
Diffstat (limited to '')
-rw-r--r--src/snap.h40
1 files changed, 27 insertions, 13 deletions
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<NR::Point> *unselected_nodes = NULL);
void setup(SPDesktop const *desktop_for_snapindicator, std::vector<SPItem const *> &items_to_ignore, std::vector<NR::Point> *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<NR::Rect> 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<NR::Rect> 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<NR::Rect> 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<NR::Rect> 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<NR::Point> const &p,
@@ -84,18 +98,18 @@ public:
NR::Point const &o) const;
Inkscape::SnappedPoint constrainedSnapStretch(Inkscape::Snapper::PointType point_type,
- std::vector<NR::Point> const &p,
- NR::Coord const &s,
- NR::Point const &o,
- NR::Dim2 d,
- bool uniform) const;
+ std::vector<NR::Point> 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<NR::Point> 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<NR::Point> 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