X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fnodepath.cpp;h=a5fd2fab8af6f5530d6b9ec343b30f38f1a79a93;hb=91db03f244c420daa37e0b5b8a8359ddc2dd626b;hp=081638f1dd83072d5edeb427ed25e3063c906804;hpb=6129af7cc5b723223e9617614c931936e5190421;p=inkscape.git diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 081638f1d..a5fd2fab8 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -411,7 +411,7 @@ static void update_repr_internal(Inkscape::NodePath::Path *np) SPCurve *curve = create_curve(np); gchar *typestr = create_typestr(np); - gchar *svgpath = sp_svg_write_path(curve->bpath); + gchar *svgpath = sp_svg_write_path(SP_CURVE_BPATH(curve)); if (repr->attribute("d") == NULL || strcmp(svgpath, repr->attribute("d"))) { // d changed np->local_change++; @@ -486,7 +486,7 @@ static void stamp_repr(Inkscape::NodePath::Path *np) SPCurve *curve = create_curve(np); gchar *typestr = create_typestr(np); - gchar *svgpath = sp_svg_write_path(curve->bpath); + gchar *svgpath = sp_svg_write_path(SP_CURVE_BPATH(curve)); new_repr->setAttribute("d", svgpath); new_repr->setAttribute("sodipodi:nodetypes", typestr); @@ -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() - n->pos; } } } @@ -2839,7 +2836,7 @@ static gboolean node_handle_request(SPKnot *knot, NR::Point *p, guint state, gpo NRPathcode const othercode = sp_node_path_code_from_side(n, opposite); - SnapManager const m(n->subpath->nodepath->desktop->namedview); + SnapManager const &m = n->subpath->nodepath->desktop->namedview->snap_manager; if (opposite->other && (n->type != Inkscape::NodePath::NODE_CUSP) && (othercode == NR_LINETO)) { /* We are smooth node adjacent with line */ @@ -2852,7 +2849,7 @@ static gboolean node_handle_request(SPKnot *knot, NR::Point *p, guint state, gpo NR::Coord const scal = dot(delta, ndelta) / linelen; (*p) = n->pos + (scal / linelen) * ndelta; } - *p = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT, *p, ndelta, NULL).getPoint(); + *p = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT, *p, Inkscape::Snapper::ConstraintLine(*p, ndelta), NULL).getPoint(); } else { *p = m.freeSnap(Inkscape::Snapper::SNAP_POINT, *p, NULL).getPoint(); }