X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Fsrc%2Fgtkmm%2Fstate_smoothmove.cpp;h=85442cf48284c7ebf6a28b801a9e781edd927492;hb=1a1e0c7df827bcb4b68d9781101c72a7ca64185b;hp=56ca977e768f93dfd42501d76c6fe6bdb45b3975;hpb=adfc80c126f482d7ea2bac38001a2c4a7c7df88c;p=synfig.git diff --git a/synfig-studio/src/gtkmm/state_smoothmove.cpp b/synfig-studio/src/gtkmm/state_smoothmove.cpp index 56ca977..85442cf 100644 --- a/synfig-studio/src/gtkmm/state_smoothmove.cpp +++ b/synfig-studio/src/gtkmm/state_smoothmove.cpp @@ -7,6 +7,7 @@ ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** Copyright (c) 2008 Chris Moore +** Copyright (c) 2009 Nikita Kitaev ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -33,6 +34,8 @@ #include #include +#include +#include #include #include @@ -262,6 +265,8 @@ DuckDrag_SmoothMove::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vecto int i; + Time time(duckmatic->get_time()); + // process vertex and position ducks first for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++) { @@ -276,7 +281,7 @@ DuckDrag_SmoothMove::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vecto dist=0; last_[i]=vect*dist; - (*iter)->set_trans_point(p+last_[i]); + (*iter)->set_trans_point(p+last_[i], time); } // then process non vertex and non position ducks @@ -293,9 +298,12 @@ DuckDrag_SmoothMove::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vecto dist=0; last_[i]=vect*dist; - (*iter)->set_trans_point(p+last_[i]); + (*iter)->set_trans_point(p+last_[i], time); } + // then patch up the tangents for the vertices we've moved + duckmatic->update_ducks(); + last_translate_=vect; //snap=Vector(0,0); } @@ -316,9 +324,45 @@ DuckDrag_SmoothMove::end_duck_drag(Duckmatic* duckmatic) for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++) { if(last_[i].mag()>0.0001) - if(!(*iter)->signal_edited()((*iter)->get_point())) { - throw String("Bad Move"); + if ((*iter)->get_type() == Duck::TYPE_ANGLE) + { + if(!(*iter)->signal_edited_angle()((*iter)->get_rotations())) + { + throw String("Bad edit"); + } + } + else if (App::restrict_radius_ducks && + (*iter)->is_radius()) + { + Point point((*iter)->get_point()); + bool changed = false; + + if (point[0] < 0) + { + point[0] = 0; + changed = true; + } + if (point[1] < 0) + { + point[1] = 0; + changed = true; + } + + if (changed) (*iter)->set_point(point); + + if(!(*iter)->signal_edited()(point)) + { + throw String("Bad edit"); + } + } + else + { + if(!(*iter)->signal_edited()((*iter)->get_point())) + { + throw String("Bad edit"); + } + } } } //duckmatic->get_selected_ducks()=new_set;