From: Nikita Kitaev Date: Sat, 5 Dec 2009 05:56:44 +0000 (-0800) Subject: Snapping in normal tool X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f5a6faad95ff8a107f3196d69c81dd2acd45e3f8;p=synfig.git Snapping in normal tool * Override shift-key axis lock in rotate and scale modes * Constrained rotation snaps to 15 degree intervals --- diff --git a/synfig-studio/src/gtkmm/state_normal.cpp b/synfig-studio/src/gtkmm/state_normal.cpp index 36b9f8b..2810db2 100644 --- a/synfig-studio/src/gtkmm/state_normal.cpp +++ b/synfig-studio/src/gtkmm/state_normal.cpp @@ -675,7 +675,10 @@ DuckDrag_Combo::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector) if(bad_drag) return; - //std::set >::iterator iter; + //Override axis lock set in workarea when holding down the shift key + if (!move_only && (scale || rotate)) + duckmatic->set_axis_lock(false); + synfig::Vector vect; if (move_only || (!scale && !rotate)) vect= duckmatic->snap_point_to_grid(vector)-drag_offset+snap; @@ -715,8 +718,13 @@ DuckDrag_Combo::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector) if (rotate) { - Angle::tan angle(vect[1],vect[0]); + Angle::deg angle(Angle::tan(vect[1],vect[0])); angle=original_angle-angle; + if (constrain) + { + float degrees = angle.get()/15; + angle= Angle::deg (degrees>0?std::floor(degrees)*15:std::ceil(degrees)*15); + } Real mag(vect.mag()/original_mag); Real sine(Angle::sin(angle).get()); Real cosine(Angle::cos(angle).get());