From: dooglus Date: Sun, 11 Nov 2007 10:46:39 +0000 (+0000) Subject: Initial support for duck drags of more than 180 degrees. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;ds=inline;h=024303231c004a2c254bed75a078e01227cdedb7;p=synfig.git Initial support for duck drags of more than 180 degrees. git-svn-id: http://svn.voria.com/code@1131 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/duck.cpp b/synfig-studio/trunk/src/gtkmm/duck.cpp index b345be5..ec67e16 100644 --- a/synfig-studio/trunk/src/gtkmm/duck.cpp +++ b/synfig-studio/trunk/src/gtkmm/duck.cpp @@ -30,6 +30,7 @@ #endif #include "duck.h" +#include #endif @@ -64,6 +65,7 @@ int _DuckCounter::counter(0); /* === M E T H O D S ======================================================= */ Duck::Duck(): + rotations(synfig::Angle::deg(0)), origin(0,0), scalar(1), editable(false), @@ -74,6 +76,7 @@ Duck::Duck(): Duck::Duck(const synfig::Point &point): type_(TYPE_NONE), point(point), + rotations(synfig::Angle::deg(0)), origin(0,0), scalar(1), guid_(0), @@ -84,6 +87,7 @@ Duck::Duck(const synfig::Point &point): Duck::Duck(const synfig::Point &point,const synfig::Point &origin): point(point), + rotations(synfig::Angle::deg(0)), origin(origin), scalar(1), guid_(0), @@ -184,7 +188,20 @@ Duck::get_sub_trans_point()const void Duck::set_sub_trans_point(const synfig::Point &x) { - set_point((x-get_sub_trans_origin())/get_scalar()); + if (get_type() == Duck::TYPE_TANGENT || + get_type() == Duck::TYPE_ANGLE) + { + Angle old_angle = get_point().angle(); + set_point((x-get_sub_trans_origin())/get_scalar()); + Angle new_angle = get_point().angle(); + int old_quarters = round_to_int(Angle::deg(rotations).get()/90); + rotations += new_angle.dist(old_angle); + int new_quarters = round_to_int(Angle::deg(rotations).get()/90); + if (old_quarters != new_quarters) + synfig::info("rotation: %.2f turns", new_quarters/4.0); + } + else + set_point((x-get_sub_trans_origin())/get_scalar()); } synfig::Point diff --git a/synfig-studio/trunk/src/gtkmm/duck.h b/synfig-studio/trunk/src/gtkmm/duck.h index d29ce11..89bebdc 100644 --- a/synfig-studio/trunk/src/gtkmm/duck.h +++ b/synfig-studio/trunk/src/gtkmm/duck.h @@ -107,6 +107,7 @@ private: Type type_; synfig::Point point; + synfig::Angle rotations; etl::smart_ptr shared_point;