Skip to content

Commit

Permalink
test: test snap accuracy #592
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed Jul 21, 2022
1 parent 60e2d6e commit 6e102cf
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export default function App(props: Record<string, any>) {
return (
<div className="root">
<div className="container" style={{
left: "200px",
top: "100px",
width: "500px",
height: "500px",
border: "1px solid #ccc",
Expand Down
4 changes: 4 additions & 0 deletions packages/react-moveable/stories/99-Tests/Deafult.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ group.add("Check drag accuracy when using bounds", {
app: require("./ReactAccuracyApp").default,
text: require("!!raw-loader!./ReactAccuracyApp").default,
});
group.add("Check element guidelines accuracy when zoom is large", {
app: require("./ReactLargeZoomElementGuidelinesApp").default,
text: require("!!raw-loader!./ReactLargeZoomElementGuidelinesApp").default,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import * as React from "react";
import Moveable from "@/react-moveable";

export default function App() {
return <div className="container" style={{
}}>
<div className="preview" style={{
position: "relative",
width: "800px",
height: "800px",
transform: "scale(3.67123)",
transformOrigin: "20% 20%",
background: "#eee",
}}>
<div className="target target1" style={{
top: "0px",
left: "0px",
width: "142.1232px",
transform: "translate(150px, 100px)",
}}>Target1</div>
<div className="target target2" style={{
top: "0px",
left: "100px",
width: "142.1232px",
transform: "translate(150px, 100px)",
}}>Target2</div>
</div>
<Moveable
target={".target"}
draggable={true}
snappable={true}
snapDirections={{
"top": true,
"left": true,
"bottom": true,
"right": true,
"center": true,
"middle": true,
}}
elementSnapDirections={{
"top": true, "left": true,
"bottom": true, "right": true,
"center": true, "middle": true,
}}
individualGroupable={true}
snapGap={true}
elementGuidelines={[".target1"]}
onDrag={e => {
e.target.style.transform = e.transform;
}}
/>
</div>;
}

0 comments on commit 6e102cf

Please sign in to comment.