summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 24868f0)
raw | patch | inline | side by side (parent: 24868f0)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Fri, 21 Aug 2009 22:30:43 +0000 (22:30 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Fri, 21 Aug 2009 22:30:43 +0000 (22:30 +0000) |
src/nodepath.cpp | patch | blob | history |
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 5b2a738d3dc2c96e4d007a0bb0064b01a5149c8a..29a04c92bc0e112bed20c29659f4d4c5191fbe54 100644 (file)
--- 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;