summaryrefslogtreecommitdiffstats
path: root/src/snapper.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2006-05-05 14:22:41 +0000
committercth103 <cth103@users.sourceforge.net>2006-05-05 14:22:41 +0000
commitb0bda995cebf5befd80a735796661fb670eca179 (patch)
tree374d96842b1befddde6bb2dc503b1700535982b2 /src/snapper.h
parentremove overdefinition (diff)
downloadinkscape-b0bda995cebf5befd80a735796661fb670eca179.tar.gz
inkscape-b0bda995cebf5befd80a735796661fb670eca179.zip
Various snapping cleanups and bug fixes.
(bzr r734)
Diffstat (limited to 'src/snapper.h')
-rw-r--r--src/snapper.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/snapper.h b/src/snapper.h
index 2f3c487d6..33a15bd04 100644
--- a/src/snapper.h
+++ b/src/snapper.h
@@ -54,14 +54,39 @@ public:
NR::Point const &p,
std::list<SPItem const *> const &it) const;
+ class ConstraintLine
+ {
+ public:
+ ConstraintLine(NR::Point const &d) : _has_point(false), _direction(d) {}
+ ConstraintLine(NR::Point const &p, NR::Point const &d) : _has_point(true), _point(p), _direction(d) {}
+
+ bool hasPoint() const {
+ return _has_point;
+ }
+
+ NR::Point getPoint() const {
+ return _point;
+ }
+
+ NR::Point getDirection() const {
+ return _direction;
+ }
+
+ private:
+
+ bool _has_point;
+ NR::Point _point;
+ NR::Point _direction;
+ };
+
SnappedPoint constrainedSnap(PointType t,
NR::Point const &p,
- NR::Point const &c,
+ ConstraintLine const &c,
SPItem const *it) const;
SnappedPoint constrainedSnap(PointType t,
NR::Point const &p,
- NR::Point const &c,
+ ConstraintLine const &c,
std::list<SPItem const *> const &it) const;
protected:
SPNamedView const *_named_view;
@@ -91,7 +116,7 @@ private:
* \return Snapped point.
*/
virtual SnappedPoint _doConstrainedSnap(NR::Point const &p,
- NR::Point const &c,
+ ConstraintLine const &c,
std::list<SPItem const *> const &it) const = 0;
::NR::Coord _distance; ///< snap distance (desktop coordinates)