summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDiederik van Lierop <mailat-signdiedenrezidotnl>2010-08-11 06:43:24 +0000
committerDiederik van Lierop <mailat-signdiedenrezidotnl>2010-08-11 06:43:24 +0000
commit19117c36082531a00df461260f917d1207edde1f (patch)
tree4670bf8aef55b561c790e6498e8ad88592a83d75 /src
parentImplement constrained snapping to nodes (diff)
downloadinkscape-19117c36082531a00df461260f917d1207edde1f.tar.gz
inkscape-19117c36082531a00df461260f917d1207edde1f.zip
Clear pointers in the snapmanager if they're no longer needed.
(bzr r9697)
Diffstat (limited to 'src')
-rw-r--r--src/arc-context.cpp2
-rw-r--r--src/box3d-context.cpp4
-rw-r--r--src/connector-context.cpp6
-rw-r--r--src/context-fns.cpp2
-rw-r--r--src/desktop-events.cpp12
-rw-r--r--src/draw-context.cpp2
-rw-r--r--src/gradient-context.cpp3
-rw-r--r--src/gradient-drag.cpp3
-rw-r--r--src/knot-holder-entity.cpp3
-rw-r--r--src/pen-context.cpp5
-rw-r--r--src/pencil-context.cpp2
-rw-r--r--src/rect-context.cpp3
-rw-r--r--src/seltrans.cpp15
-rw-r--r--src/snap.h6
-rw-r--r--src/spiral-context.cpp7
-rw-r--r--src/star-context.cpp6
-rw-r--r--src/ui/clipboard.cpp1
-rw-r--r--src/ui/tool/node.cpp2
18 files changed, 69 insertions, 15 deletions
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index 799167a72..3c0d9ccda 100644
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
@@ -251,6 +251,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK,
NULL, event->button.time);
ret = TRUE;
+ m.unSetup();
}
break;
case GDK_MOTION_NOTIFY:
@@ -281,6 +282,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
Geom::Point const motion_w(event->motion.x, event->motion.y);
Geom::Point motion_dt(desktop->w2d(motion_w));
m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
break;
case GDK_BUTTON_RELEASE:
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index 5534aa410..37e9e210c 100644
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
@@ -317,6 +317,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, true, bc->item);
m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
bc->center = from_2geom(button_dt);
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -349,7 +350,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, true, bc->item);
m.freeSnapReturnByRef(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE);
-
bc->ctrl_dragged = event->motion.state & GDK_CONTROL_MASK;
if (event->motion.state & GDK_SHIFT_MASK && !bc->extruded && bc->item) {
@@ -383,6 +383,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
}
m.freeSnapReturnByRef(bc->drag_ptC, Inkscape::SNAPSOURCE_NODE_HANDLE);
}
+ m.unSetup();
sp_box3d_drag(*bc, event->motion.state);
@@ -394,6 +395,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
Geom::Point const motion_w(event->motion.x, event->motion.y);
Geom::Point motion_dt(desktop->w2d(motion_w));
m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
break;
case GDK_BUTTON_RELEASE:
diff --git a/src/connector-context.cpp b/src/connector-context.cpp
index b0e192190..3791034d6 100644
--- a/src/connector-context.cpp
+++ b/src/connector-context.cpp
@@ -824,6 +824,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
default:
break;
}
+ m.unSetup();
} else if (bevent.button == 3) {
if (cc->state == SP_CONNECTOR_CONTEXT_REROUTING) {
// A context menu is going to be triggered here,
@@ -997,6 +998,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
}
break;
}
+ m.unSetup();
}
else if ( cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE )
{
@@ -1121,6 +1123,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
break;
}
}
+ m.unSetup();
}
@@ -1207,6 +1210,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval)
cp.pos = p * sp_item_dt2i_affine(cc->active_shape);
cc->active_shape->avoidRef->updateConnectionPoint(cp);
}
+ m.unSetup();
cc->state = SP_CONNECTOR_CONTEXT_IDLE;
ret = TRUE;
@@ -1230,7 +1234,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval)
Geom::Point p = cc->selected_handle->pos;
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
-
+ m.unSetup();
sp_knot_set_position(cc->selected_handle, p, 0);
ConnectionPoint cp;
diff --git a/src/context-fns.cpp b/src/context-fns.cpp
index b22cd488d..6da1813ca 100644
--- a/src/context-fns.cpp
+++ b/src/context-fns.cpp
@@ -209,6 +209,8 @@ Geom::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item
p[0] *= desktop->dt2doc();
p[1] *= desktop->dt2doc();
+ m.unSetup();
+
return Geom::Rect(Geom::Point(MIN(p[0][Geom::X], p[1][Geom::X]), MIN(p[0][Geom::Y], p[1][Geom::Y])),
Geom::Point(MAX(p[0][Geom::X], p[1][Geom::X]), MAX(p[0][Geom::Y], p[1][Geom::Y])));
}
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index bb22b0faa..d5d57717f 100644
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -150,6 +150,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge
// Because the guide snapper only looks in the document for guides to snap to,
// we don't have to worry about a guide snapping to itself here
m.guideFreeSnap(event_dt, normal, SP_DRAG_MOVE_ORIGIN);
+ m.unSetup();
}
sp_guideline_set_position(SP_GUIDELINE(guide), from_2geom(event_dt));
@@ -172,6 +173,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge
// Because the guide snapper only looks in the document for guides to snap to,
// we don't have to worry about a guide snapping to itself here
m.guideFreeSnap(event_dt, normal, SP_DRAG_MOVE_ORIGIN);
+ m.unSetup();
}
dragging = false;
@@ -297,9 +299,10 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
m.guideConstrainedSnap(motion_dt, *guide);
}
} else if (!((drag_type == SP_DRAG_ROTATE) && (event->motion.state & GDK_CONTROL_MASK))) {
- // cannot use shift here to disable snapping, because we already use it for rotating the guide
- m.guideFreeSnap(motion_dt, guide->normal_to_line, drag_type);
+ // cannot use shift here to disable snapping, because we already use it for rotating the guide
+ m.guideFreeSnap(motion_dt, guide->normal_to_line, drag_type);
}
+ m.unSetup();
switch (drag_type) {
case SP_DRAG_TRANSLATE:
@@ -361,9 +364,10 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
m.guideConstrainedSnap(event_dt, *guide);
}
} else if (!((drag_type == SP_DRAG_ROTATE) && (event->motion.state & GDK_CONTROL_MASK))) {
- // cannot use shift here to disable snapping, because we already use it for rotating the guide
- m.guideFreeSnap(event_dt, guide->normal_to_line, drag_type);
+ // cannot use shift here to disable snapping, because we already use it for rotating the guide
+ m.guideFreeSnap(event_dt, guide->normal_to_line, drag_type);
}
+ m.unSetup();
if (sp_canvas_world_pt_inside_window(item->canvas, event_w)) {
switch (drag_type) {
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index c0ae626d5..9bd67c3dd 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -512,6 +512,7 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p,
SnapManager &m = SP_EVENT_CONTEXT_DESKTOP(ec)->namedview->snap_manager;
m.setup(SP_EVENT_CONTEXT_DESKTOP(ec));
m.constrainedSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE, Inkscape::Snapper::SnapConstraint(o, best));
+ m.unSetup();
}
}
}
@@ -528,6 +529,7 @@ void spdc_endpoint_snap_free(SPEventContext const * const ec, Geom::Point& p, gu
m.setup(dt, true, selection->singleItem());
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
}
static SPCurve *
diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp
index bf1566b26..013c9bcd8 100644
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
@@ -557,6 +557,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
rc->origin = from_2geom(button_dt);
}
@@ -597,7 +598,9 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
Geom::Point const motion_w(event->motion.x, event->motion.y);
Geom::Point const motion_dt = event_context->desktop->w2d(motion_w);
+
m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
bool over_line = false;
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index e7536a86a..32aa7c084 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -731,6 +731,8 @@ gr_knot_moved_handler(SPKnot *knot, Geom::Point const &ppointer, guint state, gp
}
}
+ m.unSetup();
+
drag->keep_selection = (bool) g_list_find(drag->selected, dragger);
bool scale_radial = (state & GDK_CONTROL_MASK) && (state & GDK_SHIFT_MASK);
@@ -864,6 +866,7 @@ gr_knot_moved_midpoint_handler(SPKnot */*knot*/, Geom::Point const &ppointer, gu
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
m.constrainedSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE, cl);
+ m.unSetup();
}
}
Geom::Point displacement = p - dragger->point;
diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp
index be61125c4..0a449771e 100644
--- a/src/knot-holder-entity.cpp
+++ b/src/knot-holder-entity.cpp
@@ -94,8 +94,8 @@ KnotHolderEntity::snap_knot_position(Geom::Point const &p)
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, true, item);
-
m.freeSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
return s * i2d.inverse();
}
@@ -126,6 +126,7 @@ KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape:
Inkscape::Snapper::SnapConstraint transformed_constraint = Inkscape::Snapper::SnapConstraint(constraint.getPoint() * i2d, (constraint.getPoint() + constraint.getDirection()) * i2d - constraint.getPoint() * i2d);
m.constrainedSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE, transformed_constraint);
}
+ m.unSetup();
return s * i2d.inverse();
}
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 4a21d7bcb..bce499615 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -476,6 +476,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
}
spdc_create_single_dot(event_context, p, "/tools/freehand/pen", bevent.state);
ret = TRUE;
@@ -633,6 +634,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
SnapManager &m = dt->namedview->snap_manager;
m.setup(dt);
m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
break;
case SP_PEN_CONTEXT_CONTROL:
@@ -683,6 +685,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
SnapManager &m = dt->namedview->snap_manager;
m.setup(dt);
m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
}
break;
@@ -709,6 +712,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
SnapManager &m = dt->namedview->snap_manager;
m.setup(dt);
m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
break;
}
@@ -1481,6 +1485,7 @@ void pen_set_to_nearest_horiz_vert(const SPPenContext *const pc, Geom::Point &pt
m.setup(pc->desktop, true, selection->singleItem());
m.constrainedSnapReturnByRef(pt, Inkscape::SNAPSOURCE_NODE_HANDLE, cl);
+ m.unSetup();
}
}
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 9f9c187f3..845f22a21 100644
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
@@ -290,6 +290,7 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE);
}
}
+ m.unSetup();
pc->sa = anchor;
spdc_set_startpoint(pc, p);
ret = TRUE;
@@ -416,6 +417,7 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
SnapManager &m = dt->namedview->snap_manager;
m.setup(dt);
m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
break;
}
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index 7ae27c13d..d60a6630b 100644
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
@@ -284,6 +284,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
rc->center = from_2geom(button_dt);
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
@@ -323,7 +324,9 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
Geom::Point const motion_w(event->motion.x, event->motion.y);
Geom::Point motion_dt(desktop->w2d(motion_w));
+
m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
break;
case GDK_BUTTON_RELEASE:
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 764c222a8..7dbeb4173 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -1039,6 +1039,7 @@ gboolean Inkscape::SelTrans::scaleRequest(Geom::Point &pt, guint state)
geom_scale = Geom::Scale(sn.getTransformation());
pt = _calcAbsAffineGeom(geom_scale);
}
+ m.unSetup();
}
/* Status text */
@@ -1134,6 +1135,8 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, Geom
// will have to calculate pt taking the stroke width into account
pt = _calcAbsAffineGeom(geom_scale);
}
+
+ m.unSetup();
}
// status text
@@ -1226,6 +1229,8 @@ gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, Geom::P
} else {
_desktop->snapindicator->remove_snaptarget();
}
+
+ m.unSetup();
}
// Update the handle position
@@ -1299,6 +1304,7 @@ gboolean Inkscape::SelTrans::rotateRequest(Geom::Point &pt, guint state)
m.setup(_desktop, false, _items_const);
// When rotating, we cannot snap the corners of the bounding box, see the comment in "constrainedSnapRotate" for details
Inkscape::SnappedPoint sn = m.constrainedSnapRotate(_snap_points, _point, radians, _origin);
+ m.unSetup();
if (sn.getSnapped()) {
_desktop->snapindicator->set_new_snaptarget(sn);
@@ -1309,6 +1315,7 @@ gboolean Inkscape::SelTrans::rotateRequest(Geom::Point &pt, guint state)
} else {
_desktop->snapindicator->remove_snaptarget();
}
+
}
@@ -1331,9 +1338,6 @@ gboolean Inkscape::SelTrans::rotateRequest(Geom::Point &pt, guint state)
// Move the item's transformation center
gboolean Inkscape::SelTrans::centerRequest(Geom::Point &pt, guint state)
{
- SnapManager &m = _desktop->namedview->snap_manager;
- m.setup(_desktop);
-
// Center is being dragged for the first item in the selection only
// Find out which item is first ...
GSList *items = (GSList *) const_cast<Selection *>(_selection)->itemList();
@@ -1343,8 +1347,11 @@ gboolean Inkscape::SelTrans::centerRequest(Geom::Point &pt, guint state)
}
// ... and store that item because later on we need to make sure that
// this transformation center won't snap to itself
+ SnapManager &m = _desktop->namedview->snap_manager;
+ m.setup(_desktop);
m.setRotationCenterSource(first);
m.freeSnapReturnByRef(pt, Inkscape::SNAPSOURCE_ROTATION_CENTER);
+ m.unSetup();
if (state & GDK_CONTROL_MASK) {
if ( fabs(_point[Geom::X] - pt[Geom::X]) > fabs(_point[Geom::Y] - pt[Geom::Y]) ) {
@@ -1439,6 +1446,7 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
}
m.setup(_desktop, true, _items_const);
dxy = m.multipleOfGridPitch(dxy, _point);
+ m.unSetup();
} else if (shift) {
if (control) { // shift & control: constrained movement without snapping
if (fabs(dxy[Geom::X]) > fabs(dxy[Geom::Y])) {
@@ -1493,6 +1501,7 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
double elapsed = ((((double)endtime.tv_sec - starttime.tv_sec) * G_USEC_PER_SEC + (endtime.tv_usec - starttime.tv_usec))) / 1000.0;
std::cout << "Time spent snapping: " << elapsed << std::endl; */
}
+ m.unSetup();
/* Pick one */
Inkscape::SnappedPoint best_snapped_point;
diff --git a/src/snap.h b/src/snap.h
index c85c51963..9a99cea07 100644
--- a/src/snap.h
+++ b/src/snap.h
@@ -98,6 +98,12 @@ public:
std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = NULL,
SPGuide *guide_to_ignore = NULL);
+ void unSetup() {_rotation_center_source_item = NULL;
+ _guide_to_ignore = NULL;
+ _desktop = NULL;
+ _named_view = NULL;
+ _unselected_nodes = NULL;}
+
// If we're dragging a rotation center, then setRotationCenterSource() stores the parent item
// of this rotation center; this reference is used to make sure that we do not snap a rotation
// center to itself
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 7ce9d4710..822fafb75 100644
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
@@ -242,7 +242,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
m.freeSnapReturnByRef(sc->center, Inkscape::SNAPSOURCE_NODE_HANDLE);
-
+ m.unSetup();
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
( GDK_KEY_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
@@ -272,6 +272,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, true, sc->item);
m.freeSnapReturnByRef(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
sp_spiral_drag(sc, from_2geom(motion_dt), event->motion.state);
gobble_motion_events(GDK_BUTTON1_MASK);
@@ -280,10 +281,10 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
} else if (!sp_event_context_knot_mouseover(sc)) {
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
-
Geom::Point const motion_w(event->motion.x, event->motion.y);
Geom::Point motion_dt(desktop->w2d(motion_w));
m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
break;
case GDK_BUTTON_RELEASE:
@@ -430,7 +431,7 @@ sp_spiral_drag(SPSpiralContext *sc, Geom::Point p, guint state)
m.setup(desktop, true, sc->item);
Geom::Point pt2g = to_2geom(p);
m.freeSnapReturnByRef(pt2g, Inkscape::SNAPSOURCE_NODE_HANDLE);
-
+ m.unSetup();
Geom::Point const p0 = desktop->dt2doc(sc->center);
Geom::Point const p1 = desktop->dt2doc(pt2g);
diff --git a/src/star-context.cpp b/src/star-context.cpp
index 63a15545f..9a2a67a57 100644
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
@@ -260,7 +260,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, true);
m.freeSnapReturnByRef(sc->center, Inkscape::SNAPSOURCE_NODE_HANDLE);
-
+ m.unSetup();
sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
@@ -297,7 +297,9 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
Geom::Point const motion_w(event->motion.x, event->motion.y);
Geom::Point motion_dt(desktop->w2d(motion_w));
+
m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE));
+ m.unSetup();
}
break;
case GDK_BUTTON_RELEASE:
@@ -443,7 +445,7 @@ static void sp_star_drag(SPStarContext *sc, Geom::Point p, guint state)
m.setup(desktop, true, sc->item);
Geom::Point pt2g = to_2geom(p);
m.freeSnapReturnByRef(pt2g, Inkscape::SNAPSOURCE_NODE_HANDLE);
-
+ m.unSetup();
Geom::Point const p0 = desktop->dt2doc(sc->center);
Geom::Point const p1 = desktop->dt2doc(pt2g);
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 0a64e7fa7..4a71174b7 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -875,6 +875,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDesktop *desktop, SPDocument *clipdo
// get offset from mouse pointer to bbox center, snap to grid if enabled
Geom::Point mouse_offset = desktop->point() - sel_bbox->midpoint();
offset = m.multipleOfGridPitch(mouse_offset - offset, sel_bbox->midpoint() + offset) + offset;
+ m.unSetup();
}
sp_selection_move_relative(selection, offset);
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index a8582ccc5..4c8cc74d8 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -274,8 +274,10 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event)
} else {
sm.freeSnapReturnByRef(new_pos, SNAPSOURCE_NODE_HANDLE);
}
+ sm.unSetup();
}
+
// with Shift, if the node is cusp, rotate the other handle as well
if (_parent->type() == NODE_CUSP && !_drag_out) {
if (held_shift(*event)) {