From: Krzysztof KosiƄski Date: Tue, 12 Oct 2010 16:22:08 +0000 (+0200) Subject: Fix oddities related to smooth endnodes. Should fix a crasher. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e86f16c5e563b3b51338598f5d90cbc3067adcda;p=inkscape.git Fix oddities related to smooth endnodes. Should fix a crasher. --- diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index a5952c9fb..7efb6a5dc 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -580,13 +580,15 @@ void Node::setType(NodeType type, bool update_handles) _updateAutoHandles(); break; case NODE_SMOOTH: { + // ignore attempts to make smooth endnodes. + if (isEndNode()) return; // rotate handles to be colinear // for degenerate nodes set positions like auto handles bool prev_line = _is_line_segment(_prev(), this); bool next_line = _is_line_segment(this, _next()); if (_type == NODE_SMOOTH) { - // for a node that is already smooth and has a degenerate handle, - // drag out the second handle to 1/3 the length of the linear segment + // For a node that is already smooth and has a degenerate handle, + // drag out the second handle without changing the direction of the first one. if (_front.isDegenerate()) { double dist = Geom::distance(_next()->position(), position()); _front.setRelativePos(Geom::unit_vector(-_back.relativePos()) * dist / 3); diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 81fc336ce..41be81d4f 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1325,17 +1325,11 @@ bool PathManipulator::_nodeClicked(Node *n, GdkEventButton *event) return true; } else if (held_control(*event)) { // Ctrl+click: cycle between node types - if (n->isEndNode()) { - if (n->type() == NODE_CUSP) { - n->setType(NODE_SMOOTH); - } else { - n->setType(NODE_CUSP); - } - } else { + if (!n->isEndNode()) { n->setType(static_cast((n->type() + 1) % NODE_LAST_REAL_TYPE)); + update(); + _commit(_("Cycle node type")); } - update(); - _commit(_("Cycle node type")); return true; } return false;