Fix 1891391: Inserting a vertex in the closing link of a looped bline while still...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 11 Feb 2008 20:22:42 +0000 (20:22 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 11 Feb 2008 20:22:42 +0000 (20:22 +0000)
git-svn-id: http://svn.voria.com/code@1676 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/state_bline.cpp

index 0a010f1..56d1b6d 100644 (file)
@@ -1271,27 +1271,24 @@ StateBLine_Context::bline_insert_vertex(synfig::ValueNode_Const::Handle value_no
        for(iter=bline_point_list.begin();iter!=bline_point_list.end();++iter)
                if(*iter==value_node)
                {
-                       list<ValueNode_Const::Handle>::iterator prev(iter);
-                       --prev;
-
                        BLinePoint bline_point;
-
                        BLinePoint next_bline_point((*iter)->get_value().get(BLinePoint()));
                        BLinePoint prev_bline_point;
 
-                       if(iter!=bline_point_list.begin())
-                       {
-                               prev_bline_point=(*prev)->get_value().get(BLinePoint());
-                       }
-                       else
+                       list<ValueNode_Const::Handle>::iterator prev(iter);
+                       if(iter==bline_point_list.begin())
                        {
-                               prev_bline_point.set_vertex(Point(0,0));
-                               prev_bline_point.set_width(next_bline_point.get_width());
-                               prev_bline_point.set_origin(0.5);
-                               prev_bline_point.set_split_tangent_flag(false);
+                               assert(loop_);
+                               prev = bline_point_list.end();
                        }
+                       prev--;
+
+                       prev_bline_point=(*prev)->get_value().get(BLinePoint());
 
-                       etl::hermite<Vector> curve(prev_bline_point.get_vertex(),next_bline_point.get_vertex(),prev_bline_point.get_tangent2(),next_bline_point.get_tangent1());
+                       etl::hermite<Vector> curve(prev_bline_point.get_vertex(),
+                                                                          next_bline_point.get_vertex(),
+                                                                          prev_bline_point.get_tangent2(),
+                                                                          next_bline_point.get_tangent1());
                        etl::derivative< etl::hermite<Vector> > deriv(curve);
 
                        bline_point.set_vertex(curve(origin));