summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9b38532)
raw | patch | inline | side by side (parent: 9b38532)
| author | johanengelen <johanengelen@users.sourceforge.net> | |
| Tue, 4 Mar 2008 21:04:14 +0000 (21:04 +0000) | ||
| committer | johanengelen <johanengelen@users.sourceforge.net> | |
| Tue, 4 Mar 2008 21:04:14 +0000 (21:04 +0000) |
| src/draw-context.cpp | patch | blob | history | |
| src/pencil-context.cpp | patch | blob | history |
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 649f135728c4f913dd1a935d92bebc2fac84dbd3..64cfb76f76cf2dd00ea8c435d4702fcf8bd15641 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
#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 *
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 1088e19ed9f3a299a5d9881cc08b18776f0d8a2d..d27d363f9690c8523011d5e4ed1341f21f212558 100644 (file)
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
#include "pixmaps/cursor-pencil.xpm"
#include "display/bezier-utils.h"
#include "display/canvas-bpath.h"
+#include "display/snap-indicator.h"
#include <glibmm/i18n.h>
#include "libnr/in-svg-plane.h"
#include "libnr/n-art-bpath.h"
@@ -274,6 +275,8 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
gint ret = FALSE;
SPDesktop *const dt = pc->desktop;
+ dt->snapindicator->remove_snappoint();
+
SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
// allow scrolling
@@ -322,7 +325,11 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
p = anchor->dp;
} else if ((mevent.state & GDK_SHIFT_MASK) == 0) {
SnapManager const &m = dt->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) {
+ dt->snapindicator->set_new_snappoint(p.to_2geom());
+ }
}
if ( pc->npoints != 0 ) { // buttonpress may have happened before we entered draw context!
spdc_add_freehand_point(pc, p, mevent.state);