summaryrefslogtreecommitdiffstats
path: root/src/snapper.h
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2009-03-15 21:08:02 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2009-03-15 21:08:02 +0000
commite6a7b16084f21efb8268abfa6e8773b089cf740f (patch)
tree5938368bcddd877797cdc5cefa370df3f704d1e6 /src/snapper.h
parentstore default size in lpe::ArrayParam (diff)
downloadinkscape-e6a7b16084f21efb8268abfa6e8773b089cf740f.tar.gz
inkscape-e6a7b16084f21efb8268abfa6e8773b089cf740f.zip
Implement constrained snapping when dragging the position and size handles of a rectangle in the node tool, with the ctrl-key being pressed.
(bzr r7497)
Diffstat (limited to 'src/snapper.h')
-rw-r--r--src/snapper.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/snapper.h b/src/snapper.h
index 0110a9154..cbd52f052 100644
--- a/src/snapper.h
+++ b/src/snapper.h
@@ -86,6 +86,12 @@ public:
_has_point = true;
}
+ Geom::Point projection(Geom::Point const &p) const { // returns the projection of p on this constraintline
+ Geom::Point const p1_on_cl = _has_point ? _point : p;
+ Geom::Point const p2_on_cl = p1_on_cl + _direction;
+ return Geom::projection(p, Geom::Line(p1_on_cl, p2_on_cl));
+ }
+
private:
bool _has_point;