From: buliabyak Date: Sat, 15 Apr 2006 03:09:43 +0000 (+0000) Subject: fix node position when joining to close subpath; allow to lock the position of one... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=25b54738e7c6e65a692ba0675d3e27f9b2be2af5;p=inkscape.git fix node position when joining to close subpath; allow to lock the position of one of the nodes to be joined by mouseovering it --- diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 8aed0420b..35f64c1b3 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -836,9 +836,9 @@ static Inkscape::NodePath::Node *sp_nodepath_set_node_type(Inkscape::NodePath::N } // if one of handles is mouseovered, preserve its position - if (node->p.knot && SP_KNOT_IS_MOSEOVER(node->p.knot)) { + if (node->p.knot && SP_KNOT_IS_MOUSEOVER(node->p.knot)) { sp_node_adjust_handle(node, 1); - } else if (node->n.knot && SP_KNOT_IS_MOSEOVER(node->n.knot)) { + } else if (node->n.knot && SP_KNOT_IS_MOUSEOVER(node->n.knot)) { sp_node_adjust_handle(node, -1); } else { sp_node_adjust_handles(node); @@ -1452,16 +1452,22 @@ void sp_node_selected_join() /* a and b are endpoints */ - NR::Point c = (a->pos + b->pos) / 2; + NR::Point c; + if (a->knot && SP_KNOT_IS_MOUSEOVER(a->knot)) { + c = a->pos; + } else if (b->knot && SP_KNOT_IS_MOUSEOVER(b->knot)) { + c = b->pos; + } else { + c = (a->pos + b->pos) / 2; + } if (a->subpath == b->subpath) { Inkscape::NodePath::SubPath *sp = a->subpath; sp_nodepath_subpath_close(sp); + sp_node_moveto (sp->first, c); sp_nodepath_update_handles(sp->nodepath); - sp_nodepath_update_repr(nodepath); - return; } @@ -3354,7 +3360,7 @@ static void sp_nodepath_subpath_close(Inkscape::NodePath::SubPath *sp) //Link the head to the tail sp->first->p.other = sp->last; sp->last->n.other = sp->first; - sp->last->n.pos = sp->first->n.pos; + sp->last->n.pos = sp->last->pos + (sp->first->n.pos - sp->first->pos); sp->first = sp->last; //Remove the extra end node