-
-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support transform-box: fill-box (#1012)
Co-authored-by: Malo Guertin <malo@gokickflip.com>
- Loading branch information
1 parent
377f618
commit 7a0ed4d
Showing
3 changed files
with
71 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import * as React from "react"; | ||
import Moveable from "@/react-moveable"; | ||
|
||
export default function App(props: Record<string, any>) { | ||
return ( | ||
<div className="root"> | ||
<div | ||
className="container" | ||
style={{ | ||
transformOrigin: "0 0", | ||
transform: `scale(${props.containerScale})`, | ||
}} | ||
> | ||
<svg | ||
viewBox="0 0 500 500" | ||
style={{ | ||
border: "1px solid black", | ||
width: "500px", | ||
height: "500px", | ||
}} | ||
> | ||
<rect | ||
id="rect-1" | ||
x="100" | ||
y="100" | ||
width="50" | ||
height="50" | ||
style={{ | ||
fill: "red", | ||
transformBox: "fill-box", | ||
}} | ||
transform="rotate(45)" | ||
{...{ "transform-origin": "50% 50%" }} | ||
/> | ||
</svg> | ||
<Moveable | ||
target={"#rect-1"} | ||
draggable={true} | ||
rotatable={true} | ||
scalable={true} | ||
svgOrigin="50% 50%" | ||
onRender={(e) => { | ||
console.log(e); | ||
e.target.style.cssText += e.cssText; | ||
}} | ||
/> | ||
<Moveable | ||
target={"#rect-2"} | ||
draggable={true} | ||
rotatable={true} | ||
scalable={true} | ||
svgOrigin="50% 50%" | ||
onRender={(e) => { | ||
e.target.style.cssText += e.cssText; | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |