summaryrefslogtreecommitdiffstats
path: root/src/seltrans.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2007-03-12 20:16:28 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2007-03-12 20:16:28 +0000
commitb5eb530257a6268058d487bb69182d58624f7118 (patch)
treed0c40ad3f4c033ac945814d1520c207252e6d367 /src/seltrans.cpp
parentuse g_vsnprintf() instead of vsnprintf() to avoid platform problems (diff)
downloadinkscape-b5eb530257a6268058d487bb69182d58624f7118.tar.gz
inkscape-b5eb530257a6268058d487bb69182d58624f7118.zip
fix snapping while uniformly scaling, fix snapping while skewing
(bzr r2621)
Diffstat (limited to 'src/seltrans.cpp')
-rw-r--r--src/seltrans.cpp13
1 files 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<NR::scale, bool> 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<NR::Coord, bool> const bb = m.freeSnapStretch(
Snapper::BBOX_POINT,
_bbox_points,
@@ -1087,14 +1092,14 @@ gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, NR::Poi
std::list<SPItem const *>(),
skew[dim_a],
_origin,
- dim_a);
+ dim_b);
std::pair<NR::Coord, bool> sn = m.freeSnapSkew(Inkscape::Snapper::SNAP_POINT,
_snap_points,
std::list<SPItem const *>(),
skew[dim_a],
_origin,
- dim_a);
+ dim_b);
if (bb.second || sn.second) {
/* We snapped something, so change the skew to reflect it */