diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2007-03-31 12:01:58 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2007-03-31 12:01:58 +0000 |
| commit | 6d8c2c46aa5eb3604fe5220f1bff47b79907502a (patch) | |
| tree | 56232a2e9fc579db3a481fda1f9ec1c082ee8f42 /src/seltrans.cpp | |
| parent | bugfix: escape string parameters on the commandline. For linux, the dollarsig... (diff) | |
| download | inkscape-6d8c2c46aa5eb3604fe5220f1bff47b79907502a.tar.gz inkscape-6d8c2c46aa5eb3604fe5220f1bff47b79907502a.zip | |
bug #1524444 (partially solved): while uniformly scaling (with ctrl-key), the correct scaling must be applied BEFORE trying to snap
(bzr r2790)
Diffstat (limited to 'src/seltrans.cpp')
| -rw-r--r-- | src/seltrans.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 5ace790ec..f62e18ac2 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -864,10 +864,17 @@ gboolean Inkscape::SelTrans::scaleRequest(NR::Point &pt, guint state) } if ((state & GDK_CONTROL_MASK) || _desktop->isToolboxButtonActive ("lock")) { - /* Scale is locked to a 1:1 aspect ratio, so that s[X] must be made to equal s[Y]. - ** To do this, we snap along a suitable constraint vector from the origin. - */ - + // Scale is locked to a 1:1 aspect ratio, so that s[X] must be made to equal s[Y]. + // + // The aspect-ratio must be locked before snapping + 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]); + } + + // Snap along a suitable constraint vector from the origin. + // The inclination of the constraint vector is calculated from the aspect ratio NR::Point bbox_dim = _box->dimensions(); double const aspect_ratio = bbox_dim[1] / bbox_dim[0]; // = height / width @@ -893,16 +900,8 @@ gboolean Inkscape::SelTrans::scaleRequest(NR::Point &pt, guint state) _origin_for_snappoints); 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]); - } - + /* We didn't snap, so just keep the locked aspect ratio */ } else { - /* Choose the smaller difference in scale. Since s[X] == s[Y] we can ** just compare difference in s[X]. */ @@ -993,6 +992,7 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR:: SnapManager const &m = _desktop->namedview->snap_manager; if ( state & GDK_CONTROL_MASK ) { + // on ctrl, apply symmetrical scaling instead of stretching s[perp] = fabs(s[axis]); std::pair<NR::Coord, bool> const bb = m.freeSnapStretch( |
