X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fduck.cpp;h=7c5ba663542bd0acde2ab2b86bba13343b32c417;hb=756c0d29ac1742f231e6615f9a577e574e35a4af;hp=ec67e1650f715c8aaaf3a7d34211223442bb83d9;hpb=024303231c004a2c254bed75a078e01227cdedb7;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/duck.cpp b/synfig-studio/trunk/src/gtkmm/duck.cpp index ec67e16..7c5ba66 100644 --- a/synfig-studio/trunk/src/gtkmm/duck.cpp +++ b/synfig-studio/trunk/src/gtkmm/duck.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007, 2008 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -32,6 +33,8 @@ #include "duck.h" #include +#include "general.h" + #endif /* === U S I N G =========================================================== */ @@ -70,7 +73,8 @@ Duck::Duck(): scalar(1), editable(false), radius_(false), - tangent_(false) + tangent_(false), + hover_(false) { duck_count++; _DuckCounter::counter++; } Duck::Duck(const synfig::Point &point): @@ -193,9 +197,11 @@ Duck::set_sub_trans_point(const synfig::Point &x) { Angle old_angle = get_point().angle(); set_point((x-get_sub_trans_origin())/get_scalar()); - Angle new_angle = get_point().angle(); + Angle change = get_point().angle() - old_angle; + while (change < Angle::deg(-180)) change += Angle::deg(360); + while (change > Angle::deg(180)) change -= Angle::deg(360); int old_quarters = round_to_int(Angle::deg(rotations).get()/90); - rotations += new_angle.dist(old_angle); + rotations += change; 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);