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:
@@ -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);
|
||||
|
||||
|
@@ -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 |
Reference in New Issue
Block a user