1
0
mirror of https://github.com/svg/svgo.git synced 2025-08-09 02:22:08 +03:00

Fixed transform moving around the clip. Fixes #446

This commit is contained in:
GreLI
2015-11-08 19:08:03 +03:00
parent 3a7f4ea070
commit 7af242b611
2 changed files with 10 additions and 1 deletions

View File

@@ -39,6 +39,7 @@ exports.fn = function(item) {
var intersection = {},
hasTransform = false,
hasClip = item.hasAttr('clip-path'),
intersected = item.content.every(function(inner) {
if (inner.isElem() && inner.hasAttr()) {
if (!Object.keys(intersection).length) {
@@ -62,7 +63,7 @@ exports.fn = function(item) {
for (var name in intersection) {
if (!allPath || name !== 'transform') {
if (!allPath && !hasClip || name !== 'transform') {
g.removeAttr(name);

View File

@@ -5,6 +5,10 @@
</g>
<circle fill="red" transform="scale(2)"/>
</g>
<g clip-path="url(#clipPath)">
<g transform="translate(10 10)"/>
<g transform="translate(10 10)"/>
</g>
</svg>
@@@
@@ -16,4 +20,8 @@
</g>
<circle/>
</g>
<g clip-path="url(#clipPath)">
<g transform="translate(10 10)"/>
<g transform="translate(10 10)"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 664 B