-
-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
demo: add group padding, fill-box demos
- Loading branch information
Showing
4 changed files
with
99 additions
and
0 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
59 changes: 59 additions & 0 deletions
59
packages/react-moveable/stories/4-SVG/ReactOriginFillboxApp.tsx
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,59 @@ | ||
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) => { | ||
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> | ||
); | ||
} |
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
28 changes: 28 additions & 0 deletions
28
packages/react-moveable/stories/99-Tests/ReactGroupPaddingApp.tsx
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,28 @@ | ||
import * as React from "react"; | ||
import Moveable from "@/react-moveable"; | ||
|
||
export default function App() { | ||
return ( | ||
<div className="root"> | ||
<div className="container"> | ||
<div className="target target1" style={{ | ||
borderRadius: "10px", | ||
}}>Target1</div> | ||
<div className="target target2">Target2</div> | ||
<div className="target target3">Target3</div> | ||
<Moveable | ||
target={".target"} | ||
draggable={true} | ||
resizable={true} | ||
rotatable={true} | ||
padding={{ left: 10, top: 10, right: 10, bottom: 10 }} | ||
onRenderGroup={e => { | ||
e.events.forEach(ev => { | ||
ev.target.style.cssText += ev.cssText; | ||
}); | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |