From: dooglus Date: Wed, 14 Nov 2007 22:58:47 +0000 (+0000) Subject: Fix the angle-duck rotation counter code. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4b5a2035f115d9f4624d968a9b9733d06422701f;p=synfig.git Fix the angle-duck rotation counter code. git-svn-id: http://svn.voria.com/code@1152 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/duck.cpp b/synfig-studio/trunk/src/gtkmm/duck.cpp index 8500b89..63bebe7 100644 --- a/synfig-studio/trunk/src/gtkmm/duck.cpp +++ b/synfig-studio/trunk/src/gtkmm/duck.cpp @@ -195,9 +195,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);