summaryrefslogtreecommitdiffstats
path: root/src/sp-item-group.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2014-09-19 00:07:09 +0000
committer~suv <suv-sf@users.sourceforge.net>2014-09-19 00:07:09 +0000
commit274a671c959becc8c989dc6a3561c608c173f6d3 (patch)
tree1ab36b51da49862d28ebebb8ed0db985735f6f5b /src/sp-item-group.cpp
parentupdate to trunk (r13540) (diff)
parentFix build for fink on OS X 10.9 by including unistd.h (diff)
downloadinkscape-274a671c959becc8c989dc6a3561c608c173f6d3.tar.gz
inkscape-274a671c959becc8c989dc6a3561c608c173f6d3.zip
update to trunk (r13560)
(bzr r13398.1.10)
Diffstat (limited to 'src/sp-item-group.cpp')
-rw-r--r--src/sp-item-group.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index bb52b0c55..5936cfbe5 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -644,14 +644,41 @@ void SPGroup::translateChildItems(Geom::Translate const &tr)
}
}
-// Recursively scale child items around a point
-void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p)
+// Recursively (or not) scale child items around a point
+void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bool noRecurse)
{
if ( hasChildren() ) {
for (SPObject *o = firstChild() ; o ; o = o->getNext() ) {
if ( SP_IS_ITEM(o) ) {
if (SP_IS_GROUP(o) && !SP_IS_BOX3D(o)) {
- SP_GROUP(o)->scaleChildItemsRec(sc, p);
+ /* Using recursion breaks clipping because transforms are applied
+ in coordinates for draws but nothing in defs is changed
+ instead change the transform on the entire group, and the transform
+ is applied after any references to clipping paths. However NOT using
+ recursion apparently breaks as of r13544 other parts of Inkscape
+ involved with showing/modifying units. So offer both for use
+ in different contexts.
+ */
+ if(noRecurse) {
+ // used for EMF import
+ SPItem *item = SP_ITEM(o);
+ Geom::Translate const s(p);
+ Geom::Affine final = s.inverse() * sc * s;
+ Geom::Affine tAff = item->i2dt_affine() * final;
+ item->set_i2d_affine(tAff);
+ tAff = item->transform;
+ // Eliminate common rounding error affecting EMF/WMF input.
+ // When the rounding error persists it converts the simple
+ // transform=scale() to transform=matrix().
+ if(std::abs(tAff[4]) < 1.0e-5 && std::abs(tAff[5]) < 1.0e-5){
+ tAff[4] = 0.0;
+ tAff[5] = 0.0;
+ }
+ item->doWriteTransform(item->getRepr(), tAff, NULL, true);
+ } else {
+ // used for other import
+ SP_GROUP(o)->scaleChildItemsRec(sc, p, false);
+ }
} else {
SPItem *item = SP_ITEM(o);
Geom::OptRect bbox = item->desktopVisualBounds();