From 66c8851461f04d59c2df8074c30e3d6279bf922a Mon Sep 17 00:00:00 2001 From: buliabyak Date: Fri, 21 Aug 2009 22:30:43 +0000 Subject: [PATCH] fix 379817 --- src/nodepath.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 5b2a738d3..29a04c92b 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -1201,7 +1201,9 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod // pull opposite handle in line with the existing one } } else if (no_handles) { - if (both_segments_are_lines OR both_segments_are_curves) { + if (both_segments_are_lines + OR both_segments_are_curves + OR one_is_line_but_the_curveside_node_is_selected_and_has_two_handles) { //pull both handles } else { // pull the handle opposite to line segment, making node half-smooth @@ -1213,6 +1215,10 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod bool p_is_line = sp_node_side_is_line(node, &node->p); bool n_is_line = sp_node_side_is_line(node, &node->n); +#define NODE_HAS_P_HANDLE(node) ((Geom::L2(node->pos - node->p.pos) > 1e-6)) +#define NODE_HAS_N_HANDLE(node) ((Geom::L2(node->pos - node->n.pos) > 1e-6)) +#define NODE_HAS_BOTH_HANDLES(node) ((Geom::L2(node->pos - node->n.pos) > 1e-6) && (Geom::L2(node->pos - node->p.pos) > 1e-6)) + if (p_has_handle && n_has_handle) { // do nothing, adjust_handles will line them up } else if (p_has_handle || n_has_handle) { @@ -1252,9 +1258,13 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod node->p.pos = node->pos - (len / Geom::L2(node->n.pos - node->pos)) * (node->n.pos - node->pos); } } else if (!p_has_handle && !n_has_handle) { - if ((p_is_line && n_is_line) || (!p_is_line && node->p.other && !n_is_line && node->n.other)) { - // no handles, but both segments are either lnes or curves: - //pull both handles + if ((p_is_line && n_is_line) || (!p_is_line && node->p.other && !n_is_line && node->n.other) || + (n_is_line && node->p.other && node->p.other->selected && NODE_HAS_BOTH_HANDLES(node->p.other)) || + (p_is_line && node->n.other && node->n.other->selected && NODE_HAS_BOTH_HANDLES(node->n.other)) + ) { + // no handles, but: both segments are either lines or curves; or: one is line and the + // node at the other side is selected (so it was just smoothed too!) and now has both + // handles: then pull both handles here // convert both to curves: node->code = NR_CURVETO; -- 2.30.2