From f8bc4d2360809daabbf66dbbebd92295b911bbaa Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 11 Feb 2008 20:22:42 +0000 Subject: [PATCH] Fix 1891391: Inserting a vertex in the closing link of a looped bline while still in the bline tool was putting the new vertex in the wrong place. git-svn-id: http://svn.voria.com/code@1676 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/state_bline.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/state_bline.cpp b/synfig-studio/trunk/src/gtkmm/state_bline.cpp index 0a010f1..56d1b6d 100644 --- a/synfig-studio/trunk/src/gtkmm/state_bline.cpp +++ b/synfig-studio/trunk/src/gtkmm/state_bline.cpp @@ -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::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::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 curve(prev_bline_point.get_vertex(),next_bline_point.get_vertex(),prev_bline_point.get_tangent2(),next_bline_point.get_tangent1()); + etl::hermite 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 > deriv(curve); bline_point.set_vertex(curve(origin)); -- 2.7.4