Skip to content

Commit ae0a3d3

Browse files
committed
refactor dragging logic
1 parent 2f23c09 commit ae0a3d3

File tree

2 files changed

+120
-127
lines changed

2 files changed

+120
-127
lines changed

src/components/EditorCanvas/Area.jsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
} from "@douyinfe/semi-icons";
1010
import { Tab, Action, ObjectType, State } from "../../data/constants";
1111
import {
12-
useCanvas,
1312
useLayout,
1413
useSettings,
1514
useUndoRedo,
@@ -24,15 +23,10 @@ export default function Area({
2423
data,
2524
onPointerDown,
2625
setResize,
27-
setInitCoords,
26+
setInitDimensions,
2827
}) {
2928
const ref = useRef(null);
3029
const isHovered = useHover(ref);
31-
const {
32-
pointer: {
33-
spaces: { diagram: pointer },
34-
},
35-
} = useCanvas();
3630
const { layout } = useLayout();
3731
const { settings } = useSettings();
3832
const { setSaveState } = useSaveState();
@@ -46,13 +40,11 @@ export default function Area({
4640

4741
const handleResize = (e, dir) => {
4842
setResize({ id: data.id, dir: dir });
49-
setInitCoords({
43+
setInitDimensions({
5044
x: data.x,
5145
y: data.y,
5246
width: data.width,
5347
height: data.height,
54-
pointerX: pointer.x,
55-
pointerY: pointer.y,
5648
});
5749
};
5850

0 commit comments

Comments
 (0)