From ccae666f91db5db49e79c70691a61438fde3a985 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Tue, 4 Mar 2008 20:27:20 +0000 Subject: [PATCH] snapindicator for nodehandle editing. buggy when doing constraintsnap, don't know how to fix it. Diederik? :) --- src/nodepath.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/nodepath.cpp b/src/nodepath.cpp index bc396d378..c7e6f7001 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -3528,7 +3528,7 @@ static gboolean node_handle_request(SPKnot *knot, NR::Point *p, guint /*state*/, NRPathcode const othercode = sp_node_path_code_from_side(n, opposite); SnapManager const &m = n->subpath->nodepath->desktop->namedview->snap_manager; - + Inkscape::SnappedPoint s ; if (opposite->other && (n->type != Inkscape::NodePath::NODE_CUSP) && (othercode == NR_LINETO)) { /* We are smooth node adjacent with line */ NR::Point const delta = *p - n->pos; @@ -3540,9 +3540,13 @@ static gboolean node_handle_request(SPKnot *knot, NR::Point *p, guint /*state*/, NR::Coord const scal = dot(delta, ndelta) / linelen; (*p) = n->pos + (scal / linelen) * ndelta; } - *p = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p, Inkscape::Snapper::ConstraintLine(*p, ndelta), n->subpath->nodepath->item).getPoint(); + s = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p, Inkscape::Snapper::ConstraintLine(*p, ndelta), n->subpath->nodepath->item); } else { - *p = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p, n->subpath->nodepath->item).getPoint(); + s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, *p, n->subpath->nodepath->item); + } + *p = s.getPoint(); + if (s.getDistance() < NR_HUGE) { + n->subpath->nodepath->desktop->snapindicator->set_new_snappoint((*p).to_2geom()); } sp_node_adjust_handle(n, -which); -- 2.30.2