From 09cab2fed4b3f98c514cbf2ea801be385fb3babd Mon Sep 17 00:00:00 2001 From: cth103 Date: Mon, 8 May 2006 11:28:31 +0000 Subject: [PATCH] Fix ctrl-scaling when there is no snap. --- src/seltrans.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 52907af30..bbaaf2f9d 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -805,13 +805,25 @@ gboolean Inkscape::SelTrans::scaleRequest(NR::Point &pt, guint state) s, _origin); - /* Choose the smaller difference in scale. Since s[X] == s[Y] we can - ** just compare difference in s[X]. - */ - double const bd = bb.second ? fabs(bb.first[NR::X] - s[NR::X]) : NR_HUGE; - double const sd = sn.second ? fabs(sn.first[NR::X] - s[NR::X]) : NR_HUGE; - s = (bd < sd) ? bb.first : sn.first; - + if (bb.second == false && sn.second == false) { + + /* We didn't snap, so just lock aspect ratio */ + if (fabs(s[NR::X]) > fabs(s[NR::Y])) { + s[NR::X] = fabs(s[NR::Y]) * sign(s[NR::X]); + } else { + s[NR::Y] = fabs(s[NR::X]) * sign(s[NR::Y]); + } + + } else { + + /* Choose the smaller difference in scale. Since s[X] == s[Y] we can + ** just compare difference in s[X]. + */ + double const bd = bb.second ? fabs(bb.first[NR::X] - s[NR::X]) : NR_HUGE; + double const sd = sn.second ? fabs(sn.first[NR::X] - s[NR::X]) : NR_HUGE; + s = (bd < sd) ? bb.first : sn.first; + } + } else { /* Scale aspect ratio is unlocked */ -- 2.30.2