From e31600863637aa0688672fca6bdc1d19ffffe506 Mon Sep 17 00:00:00 2001 From: dvlierop2 Date: Mon, 12 Mar 2007 20:16:28 +0000 Subject: [PATCH] fix snapping while uniformly scaling, fix snapping while skewing --- src/seltrans.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/seltrans.cpp b/src/seltrans.cpp index a1a200282..84ee0920e 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -843,10 +843,15 @@ gboolean Inkscape::SelTrans::scaleRequest(NR::Point &pt, guint state) /* 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. */ + + // 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 + // Determine direction of the constraint vector NR::Point const cv = NR::Point( pt[NR::X] > _origin[NR::X] ? 1 : -1, - pt[NR::Y] > _origin[NR::Y] ? 1 : -1 + pt[NR::Y] > _origin[NR::Y] ? aspect_ratio : -aspect_ratio ); std::pair bb = m.constrainedSnapScale(Snapper::BBOX_POINT, @@ -991,7 +996,7 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR:: s[axis] = fabs(ratio) * sign(s[axis]); s[perp] = fabs(s[axis]); } else { - + std::pair const bb = m.freeSnapStretch( Snapper::BBOX_POINT, _bbox_points, @@ -1087,14 +1092,14 @@ gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, NR::Poi std::list(), skew[dim_a], _origin, - dim_a); + dim_b); std::pair sn = m.freeSnapSkew(Inkscape::Snapper::SNAP_POINT, _snap_points, std::list(), skew[dim_a], _origin, - dim_a); + dim_b); if (bb.second || sn.second) { /* We snapped something, so change the skew to reflect it */ -- 2.30.2