diff options
| author | Carl Hetherington <cth@carlh.net> | 2006-05-08 11:28:31 +0000 |
|---|---|---|
| committer | cth103 <cth103@users.sourceforge.net> | 2006-05-08 11:28:31 +0000 |
| commit | a6fe3aba0227a2f67c10e798985bb452bb0bc7e8 (patch) | |
| tree | 774006e1b8fce6729b4b351141c6c8406ff8e26f | |
| parent | * knot.h, knot.cpp, connector-context.cpp: (diff) | |
| download | inkscape-a6fe3aba0227a2f67c10e798985bb452bb0bc7e8.tar.gz inkscape-a6fe3aba0227a2f67c10e798985bb452bb0bc7e8.zip | |
Fix ctrl-scaling when there is no snap.
(bzr r765)
| -rw-r--r-- | src/seltrans.cpp | 26 |
1 files 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 */ |
