Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: moveElemsAttrsToGroups should not move transform if group has filter attribute #1933

Merged
merged 3 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/moveElemsAttrsToGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ export const fn = (root) => {
}
}

// preserve transform on children when group has clip-path or mask
// preserve transform on children when group has filter or clip-path or mask
if (
node.attributes['filter'] != null ||
node.attributes['clip-path'] != null ||
node.attributes.mask != null
) {
Expand Down
29 changes: 29 additions & 0 deletions test/plugins/moveElemsAttrsToGroup.08.svg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Don't move transform if there is a filter attribute on group.
SethFalco marked this conversation as resolved.
Show resolved Hide resolved

===

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs>
<filter id="a" x="17" y="13" width="12" height="10" filterUnits="userSpaceOnUse">
<feGaussianBlur stdDeviation=".01"/>
</filter>
</defs>
<g filter="url(#a)">
<rect x="19" y="12" width="14" height="6" rx="3" transform="rotate(31 19 12.79)"/>
<rect x="19" y="12" width="14" height="6" rx="3" transform="rotate(31 19 12.79)"/>
</g>
</svg>

@@@

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs>
<filter id="a" x="17" y="13" width="12" height="10" filterUnits="userSpaceOnUse">
<feGaussianBlur stdDeviation=".01"/>
</filter>
</defs>
<g filter="url(#a)">
<rect x="19" y="12" width="14" height="6" rx="3" transform="rotate(31 19 12.79)"/>
<rect x="19" y="12" width="14" height="6" rx="3" transform="rotate(31 19 12.79)"/>
</g>
</svg>