Code

cleanup: Remove some commented-out code.
[inkscape.git] / src / nodepath.cpp
index 5cb4ed7f8ca543e621fa9989bfb9ca3c41c0964b..97be9355cb2863be8d05a993b9324e54c182184e 100644 (file)
@@ -854,7 +854,7 @@ static void sp_nodepath_set_line_type(Inkscape::NodePath::Node *end, NRPathcode
 /**
  * Change node type, and its handles accordingly.
  */
-static Inkscape::NodePath::Node *sp_nodepath_set_node_type(Inkscape::NodePath::Node *node,Inkscape::NodePath::NodeType type)
+static Inkscape::NodePath::Node *sp_nodepath_set_node_type(Inkscape::NodePath::Node *node, Inkscape::NodePath::NodeType type)
 {
     g_assert(node);
     g_assert(node->subpath);
@@ -880,7 +880,15 @@ static Inkscape::NodePath::Node *sp_nodepath_set_node_type(Inkscape::NodePath::N
         sp_knot_update_ctrl(node->knot);
     }
 
-    sp_node_adjust_handles(node);
+    // if one of handles is mouseovered, preserve its position
+    if (node->p.knot && SP_KNOT_IS_MOSEOVER(node->p.knot)) {
+        sp_node_adjust_handle(node, 1);
+    } else if (node->n.knot && SP_KNOT_IS_MOSEOVER(node->n.knot)) {
+        sp_node_adjust_handle(node, -1);
+    } else {
+        sp_node_adjust_handles(node);
+    }
+
     sp_node_update_handles(node);
 
     sp_nodepath_update_statusbar(node->subpath->nodepath);