summaryrefslogtreecommitdiffstats
path: root/src/draw-context.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-03-04 21:04:14 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-03-04 21:04:14 +0000
commit42725bf2904fae94d41ba8074b6783c64b71fc43 (patch)
tree193e6e4f6528b95f7711cd43e73d96af4a9db709 /src/draw-context.cpp
parentsnapindicator for gradient knots (diff)
downloadinkscape-42725bf2904fae94d41ba8074b6783c64b71fc43.tar.gz
inkscape-42725bf2904fae94d41ba8074b6783c64b71fc43.zip
snapindicator in freehand
(bzr r4959)
Diffstat (limited to 'src/draw-context.cpp')
-rw-r--r--src/draw-context.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 649f13572..64cfb76f7 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -40,6 +40,7 @@
#include "snap.h"
#include "sp-path.h"
#include "sp-namedview.h"
+#include "display/snap-indicator.h"
static void sp_draw_context_class_init(SPDrawContextClass *klass);
static void sp_draw_context_init(SPDrawContext *dc);
@@ -354,8 +355,12 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, NR::Point &p, N
/* Snap it along best vector */
SnapManager const &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager;
- p = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE,
- p, Inkscape::Snapper::ConstraintLine(best), NULL).getPoint();
+ Inkscape::SnappedPoint const s = m.constrainedSnap( Inkscape::Snapper::SNAPPOINT_NODE,
+ p, Inkscape::Snapper::ConstraintLine(best), NULL );
+ p = s.getPoint();
+ if (s.getDistance() < NR_HUGE) {
+ SP_EVENT_CONTEXT_DESKTOP(ec)->snapindicator->set_new_snappoint(p.to_2geom());
+ }
}
}
@@ -368,7 +373,11 @@ void spdc_endpoint_snap_free(SPEventContext const * const ec, NR::Point& p, guin
}
SnapManager const &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager;
- p = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p, NULL).getPoint();
+ Inkscape::SnappedPoint const s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p, NULL);
+ p = s.getPoint();
+ if (s.getDistance() < NR_HUGE) {
+ SP_EVENT_CONTEXT_DESKTOP(ec)->snapindicator->set_new_snappoint(p.to_2geom());
+ }
}
static SPCurve *