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 = {},
|
var intersection = {},
|
||||||
hasTransform = false,
|
hasTransform = false,
|
||||||
|
hasClip = item.hasAttr('clip-path'),
|
||||||
intersected = item.content.every(function(inner) {
|
intersected = item.content.every(function(inner) {
|
||||||
if (inner.isElem() && inner.hasAttr()) {
|
if (inner.isElem() && inner.hasAttr()) {
|
||||||
if (!Object.keys(intersection).length) {
|
if (!Object.keys(intersection).length) {
|
||||||
@@ -62,7 +63,7 @@ exports.fn = function(item) {
|
|||||||
|
|
||||||
for (var name in intersection) {
|
for (var name in intersection) {
|
||||||
|
|
||||||
if (!allPath || name !== 'transform') {
|
if (!allPath && !hasClip || name !== 'transform') {
|
||||||
|
|
||||||
g.removeAttr(name);
|
g.removeAttr(name);
|
||||||
|
|
||||||
|
@@ -5,6 +5,10 @@
|
|||||||
</g>
|
</g>
|
||||||
<circle fill="red" transform="scale(2)"/>
|
<circle fill="red" transform="scale(2)"/>
|
||||||
</g>
|
</g>
|
||||||
|
<g clip-path="url(#clipPath)">
|
||||||
|
<g transform="translate(10 10)"/>
|
||||||
|
<g transform="translate(10 10)"/>
|
||||||
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
@@@
|
@@@
|
||||||
@@ -16,4 +20,8 @@
|
|||||||
</g>
|
</g>
|
||||||
<circle/>
|
<circle/>
|
||||||
</g>
|
</g>
|
||||||
|
<g clip-path="url(#clipPath)">
|
||||||
|
<g transform="translate(10 10)"/>
|
||||||
|
<g transform="translate(10 10)"/>
|
||||||
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 664 B |
Reference in New Issue
Block a user