Skip to content

Commit

Permalink
fix: transformToMatrix() returns incorrect result for scale(n,0) (#1965)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkenny54 committed Feb 27, 2024
1 parent a8d2df6 commit f49b6a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/_transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ const transformToMatrix = (transform) => {
transform.data[0],
0,
0,
transform.data[1] || transform.data[0],
transform.data[1] ?? transform.data[0],
0,
0,
];
Expand Down
15 changes: 15 additions & 0 deletions test/plugins/convertTransform.15.svg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Make sure scale(n,0) is handled correctly.

===

<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -10 100 150">
<rect x="0" y="10" width="5" height="8" fill="red" transform="translate(5,70) scale(.4 0)"/>
</svg>


@@@

<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -10 100 150">
<rect x="0" y="10" width="5" height="8" fill="red" transform="matrix(.4 0 0 0 5 70)"/>
</svg>

0 comments on commit f49b6a7

Please sign in to comment.