From 55c525cac19bdb96a450c4a7810a3b980e3e8e2e Mon Sep 17 00:00:00 2001 From: speleo3 Date: Thu, 11 Dec 2008 11:37:24 +0000 Subject: [PATCH] fixed snapping of handles (broken since rev 20247) --- src/nodepath.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 1dcf3ed45..f284d818e 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -132,7 +132,7 @@ static gboolean node_request(SPKnot *knot, Geom::Point const &p, guint state, gp static void node_handle_clicked(SPKnot *knot, guint state, gpointer data); static void node_handle_grabbed(SPKnot *knot, guint state, gpointer data); static void node_handle_ungrabbed(SPKnot *knot, guint state, gpointer data); -static gboolean node_handle_request(SPKnot *knot, Geom::Point const &p, guint state, gpointer data); +static gboolean node_handle_request(SPKnot *knot, Geom::Point &p, guint state, gpointer data); static void node_handle_moved(SPKnot *knot, Geom::Point const &p, guint state, gpointer data); static gboolean node_handle_event(SPKnot *knot, GdkEvent *event, Inkscape::NodePath::Node *n); @@ -3908,7 +3908,7 @@ static void node_handle_ungrabbed(SPKnot *knot, guint state, gpointer data) /** * Node handle "request" signal callback. */ -static gboolean node_handle_request(SPKnot *knot, Geom::Point const &p, guint state, gpointer data) +static gboolean node_handle_request(SPKnot *knot, Geom::Point &p, guint state, gpointer data) { Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) data; @@ -3948,13 +3948,12 @@ static gboolean node_handle_request(SPKnot *knot, Geom::Point const &p, guint st Inkscape::NodePath::Node *othernode = opposite->other; Geom::Point const ndelta = n->pos - othernode->pos; Geom::Coord const linelen = Geom::L2(ndelta); - Geom::Point ptemp = p; if (len > NR_EPSILON && linelen > NR_EPSILON) { Geom::Coord const scal = dot(delta, ndelta) / linelen; - ptemp = n->pos + (scal / linelen) * ndelta; + p = n->pos + (scal / linelen) * ndelta; } if ((state & GDK_SHIFT_MASK) == 0) { - s = m.constrainedSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, ptemp, Inkscape::Snapper::ConstraintLine(ptemp, ndelta)); + s = m.constrainedSnap(Inkscape::SnapPreferences::SNAPPOINT_NODE, p, Inkscape::Snapper::ConstraintLine(p, ndelta)); } } else { if ((state & GDK_SHIFT_MASK) == 0) { @@ -3967,6 +3966,8 @@ static gboolean node_handle_request(SPKnot *knot, Geom::Point const &p, guint st } } + s.getPoint(p); + sp_node_adjust_handle(n, -which); return FALSE; -- 2.30.2