summaryrefslogtreecommitdiffstats
path: root/src/draw-context.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2012-01-14 13:35:29 +0000
committerDiederik van Lierop <mail@diedenrezi.nl>2012-01-14 13:35:29 +0000
commit62ab3cc3fe08cee5968581360d1509a6b01ff9f1 (patch)
tree74e36cf0869c7fb8cc6ee457c353b09fcb96ead7 /src/draw-context.cpp
parentCleanup variable declarations in ruler, and a couple of GSEAL fixes. (diff)
downloadinkscape-62ab3cc3fe08cee5968581360d1509a6b01ff9f1.tar.gz
inkscape-62ab3cc3fe08cee5968581360d1509a6b01ff9f1.zip
Enable tangential and perpendicular snapping to paths (in the node-tool, pen-tool, pencil-tool, and for guide manipulation; cannot be toggled yet, will always be active when snapping to paths)
(bzr r10886)
Diffstat (limited to 'src/draw-context.cpp')
-rw-r--r--src/draw-context.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index ebc6e320f..15b20f124 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -501,7 +501,7 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p,
}
-void spdc_endpoint_snap_free(SPEventContext const * const ec, Geom::Point& p, boost::optional<Geom::Point> &start_point, guint const /*state*/)
+void spdc_endpoint_snap_free(SPEventContext const * const ec, Geom::Point& p, boost::optional<Geom::Point> &start_of_line, guint const /*state*/)
{
SPDesktop *dt = SP_EVENT_CONTEXT_DESKTOP(ec);
SnapManager &m = dt->namedview->snap_manager;
@@ -511,7 +511,14 @@ void spdc_endpoint_snap_free(SPEventContext const * const ec, Geom::Point& p, bo
// TODO: Allow snapping to the stationary parts of the item, and only ignore the last segment
m.setup(dt, true, selection->singleItem());
- m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE, start_point);
+ Inkscape::SnapCandidatePoint scp(p, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ if (start_of_line) {
+ scp.addOrigin(*start_of_line);
+ }
+
+ Inkscape::SnappedPoint sp = m.freeSnap(scp);
+ p = sp.getPoint();
+
m.unSetup();
}