From: cth103 Date: Mon, 8 May 2006 11:28:31 +0000 (+0000) Subject: Fix ctrl-scaling when there is no snap. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=09cab2fed4b3f98c514cbf2ea801be385fb3babd;p=inkscape.git Fix ctrl-scaling when there is no snap. --- 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 */