summaryrefslogtreecommitdiffstats
path: root/src/seltrans.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2007-04-09 12:50:25 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2007-04-09 12:50:25 +0000
commit2dd9dab3e346f837339740ed363662aff88c5a17 (patch)
treeee3f31c5fc840171f7e5f02e632d8e6da0bf6ddd /src/seltrans.cpp
parentfix crash temporarily until next refactoring phase (diff)
downloadinkscape-2dd9dab3e346f837339740ed363662aff88c5a17.tar.gz
inkscape-2dd9dab3e346f837339740ed363662aff88c5a17.zip
Eliminate drift of origin if mirroring occurs during scaling/stretching
(bzr r2838)
Diffstat (limited to 'src/seltrans.cpp')
-rw-r--r--src/seltrans.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 52afc0e14..21b8a0461 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -1355,8 +1355,13 @@ void Inkscape::SelTrans::stretch(SPSelTransHandle const &handle, NR::Point &pt,
return;
}
- NR::Point new_bbox_min = _approximate_bbox->min() * (NR::translate(-scale_origin) * NR::Matrix(s) * NR::translate(scale_origin));
- NR::Point new_bbox_max = _approximate_bbox->max() * (NR::translate(-scale_origin) * NR::Matrix(s) * NR::translate(scale_origin));
+ //Get two corners of the new bbox
+ NR::Point p1 = _approximate_bbox->min() * (NR::translate(-scale_origin) * NR::Matrix(s) * NR::translate(scale_origin));
+ NR::Point p2 = _approximate_bbox->max() * (NR::translate(-scale_origin) * NR::Matrix(s) * NR::translate(scale_origin));
+
+ //Find the ones at the lower-left and upper-right, as required by get_scale_transform_with_stroke
+ NR::Point new_bbox_min = NR::Point(std::min(p1[NR::X], p2[NR::X]), std::min(p1[NR::Y], p2[NR::Y]));
+ NR::Point new_bbox_max = NR::Point(std::max(p1[NR::X], p2[NR::X]), std::max(p1[NR::Y], p2[NR::Y]));
int transform_stroke = false;
gdouble strokewidth = 0;
@@ -1387,9 +1392,15 @@ void Inkscape::SelTrans::scale(NR::Point &pt, guint state)
if (fabs(s[i]) < 1e-9)
s[i] = 1e-9;
}
- NR::Point new_bbox_min = _approximate_bbox->min() * (NR::translate(-_origin) * NR::Matrix(s) * NR::translate(_origin));
- NR::Point new_bbox_max = _approximate_bbox->max() * (NR::translate(-_origin) * NR::Matrix(s) * NR::translate(_origin));
+
+ //Get two corners of the new bbox
+ NR::Point p1 = _approximate_bbox->min() * (NR::translate(-_origin) * NR::Matrix(s) * NR::translate(_origin));
+ NR::Point p2 = _approximate_bbox->max() * (NR::translate(-_origin) * NR::Matrix(s) * NR::translate(_origin));
+ //Find the ones at the lower-left and upper-right, as required by get_scale_transform_with_stroke
+ NR::Point new_bbox_min = NR::Point(std::min(p1[NR::X], p2[NR::X]), std::min(p1[NR::Y], p2[NR::Y]));
+ NR::Point new_bbox_max = NR::Point(std::max(p1[NR::X], p2[NR::X]), std::max(p1[NR::Y], p2[NR::Y]));
+
int transform_stroke = false;
gdouble strokewidth = 0;