summaryrefslogtreecommitdiffstats
path: root/src/nodepath.cpp
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2006-05-05 16:44:29 +0000
committercth103 <cth103@users.sourceforge.net>2006-05-05 16:44:29 +0000
commit1241b0a2a63239470a6d06203aa0e5aae4678cf9 (patch)
tree008cba351e63f30d68704cb2497046edaeebcc65 /src/nodepath.cpp
parentfix 1482463 (diff)
downloadinkscape-1241b0a2a63239470a6d06203aa0e5aae4678cf9.tar.gz
inkscape-1241b0a2a63239470a6d06203aa0e5aae4678cf9.zip
More snapping cleanups.
(bzr r741)
Diffstat (limited to 'src/nodepath.cpp')
-rw-r--r--src/nodepath.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 7eb68d7d6..e81abdacb 100644
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -921,22 +921,19 @@ void sp_node_moveto(Inkscape::NodePath::Node *node, NR::Point p)
static void sp_nodepath_selected_nodes_move(Inkscape::NodePath::Path *nodepath, NR::Coord dx, NR::Coord dy,
bool const snap = true)
{
- NR::Coord best[2] = { NR_HUGE, NR_HUGE };
+ NR::Coord best = NR_HUGE;
NR::Point delta(dx, dy);
NR::Point best_pt = delta;
if (snap) {
+ SnapManager const &m = nodepath->desktop->namedview->snap_manager;
+
for (GList *l = nodepath->selected; l != NULL; l = l->next) {
- Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
- NR::Point p = n->pos + delta;
- for (int dim = 0; dim < 2; dim++) {
- NR::Coord dist = namedview_dim_snap(nodepath->desktop->namedview,
- Inkscape::Snapper::SNAP_POINT, p,
- NR::Dim2(dim), nodepath->path);
- if (dist < best[dim]) {
- best[dim] = dist;
- best_pt[dim] = p[dim] - n->pos[dim];
- }
+ Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
+ Inkscape::SnappedPoint const s = m.freeSnap(Inkscape::Snapper::SNAP_POINT, n->pos + delta, NULL);
+ if (s.getDistance() < best) {
+ best = s.getDistance();
+ best_pt = s.getPoint();
}
}
}