Code

when switching node type, preserve the position of the mouseovered handle
authorbuliabyak <buliabyak@users.sourceforge.net>
Sat, 1 Apr 2006 20:36:19 +0000 (20:36 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sat, 1 Apr 2006 20:36:19 +0000 (20:36 +0000)
src/nodepath.cpp

index 5cb4ed7f8ca543e621fa9989bfb9ca3c41c0964b..af73a37c2a1fe84130faf7f4028ad8ed7f32ceb5 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 (SP_KNOT_IS_MOSEOVER(node->p.knot)) {
+        sp_node_adjust_handle(node, 1);
+    } else if (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);