Skip to content

Commit

Permalink
fix: fix svg matrixes #643
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed May 2, 2022
1 parent b4a3ee6 commit 525ad70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions packages/react-moveable/src/react-moveable/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ export function getElementTransform(
return "";
}

const matrixs: string[] = [];
const matrixes: string[] = [];

for (let i = 0; i < length; ++i) {
const matrix = baseVal[0].matrix;
const matrix = baseVal[i].matrix;

matrixs.push(`matrix(${(["a", "b", "c", "d", "e", "f"] as const).map(chr => matrix[chr]).join(", ")})`);
matrixes.push(`matrix(${(["a", "b", "c", "d", "e", "f"] as const).map(chr => matrix[chr]).join(", ")})`);
}
return matrixs.join(" ");
return matrixes.join(" ");

}
return "";
}
Expand Down
5 changes: 3 additions & 2 deletions packages/react-moveable/stories/4-SVG/apps/ReactSVGGApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ export default function App(props: Record<string, any>) {
left: "100px",
}}>
<g
transform="translate(10, 10) rotate(0)"
style={{
transform: "translate(10px, 10px) rotate(20deg)",
// transform: "translate(10px, 10px) rotate(20deg)",
}}
>
<path d="M 0 0 L 200 0 L 200 200 z" ref={targetRef} style={{
fill: "white",
stroke: "red",
strokeWidth: 2,
transform: "translate(10px, 10px) rotate(20deg)",
// transform: "translate(10px, 10px) rotate(20deg)",
}} />
</g>
</svg>
Expand Down

0 comments on commit 525ad70

Please sign in to comment.