diff --git a/plugins/moveElemsAttrsToGroup.js b/plugins/moveElemsAttrsToGroup.js
index 52e0c616..932efe3a 100644
--- a/plugins/moveElemsAttrsToGroup.js
+++ b/plugins/moveElemsAttrsToGroup.js
@@ -29,6 +29,7 @@ exports.moveElemsAttrsToGroup = function(item, params) {
if (item.isElem('g') && !item.isEmpty() && item.content.length > 1) {
var intersection = {},
+ hasTransform = false,
every = item.content.every(function(g) {
if (g.elem && g.attrs) {
if (!Object.keys(intersection).length) {
@@ -48,7 +49,15 @@ exports.moveElemsAttrsToGroup = function(item, params) {
item.content.forEach(function(g) {
for (var name in intersection) {
g.removeAttr(name);
- item.addAttr(intersection[name]);
+
+ if (name === 'transform') {
+ if (!hasTransform) {
+ item.attr('transform').value += ' ' + intersection[name].value;
+ hasTransform = true;
+ }
+ } else {
+ item.addAttr(intersection[name]);
+ }
}
});
}
diff --git a/test/plugins/moveElemsAttrsToGroup.04.orig.svg b/test/plugins/moveElemsAttrsToGroup.04.orig.svg
new file mode 100644
index 00000000..e3fae5d7
--- /dev/null
+++ b/test/plugins/moveElemsAttrsToGroup.04.orig.svg
@@ -0,0 +1,8 @@
+
diff --git a/test/plugins/moveElemsAttrsToGroup.04.should.svg b/test/plugins/moveElemsAttrsToGroup.04.should.svg
new file mode 100644
index 00000000..0b1a2df1
--- /dev/null
+++ b/test/plugins/moveElemsAttrsToGroup.04.should.svg
@@ -0,0 +1,8 @@
+