Skip to content

Commit 52129bc

Browse files
committed
clean up
1 parent 31277e8 commit 52129bc

File tree

2 files changed

+20
-19
lines changed
  • apps/web/client/src

2 files changed

+20
-19
lines changed

apps/web/client/src/app/project/[id]/_components/canvas/frame/gesture.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,25 @@ export const GestureScreen = observer(({ frame, isResizing }: { frame: Frame, is
9494
[getRelativeMousePosition, editorEngine],
9595
);
9696

97-
const throttledMouseMove = useMemo(
98-
() =>
99-
throttle(async (e: React.MouseEvent<HTMLDivElement>) => {
100-
101-
if (
102-
editorEngine.state.editorMode === EditorMode.DESIGN ||
103-
((editorEngine.state.editorMode === EditorMode.INSERT_DIV ||
104-
editorEngine.state.editorMode === EditorMode.INSERT_TEXT ||
105-
editorEngine.state.editorMode === EditorMode.INSERT_IMAGE) &&
106-
!editorEngine.insert.isDrawing)
107-
) {
108-
await handleMouseEvent(e, MouseAction.MOVE);
109-
} else if (editorEngine.insert.isDrawing) {
110-
editorEngine.insert.draw(e);
111-
}
112-
}, 16),
113-
[editorEngine, getRelativeMousePosition, handleMouseEvent],
97+
const throttledMouseMove = useMemo(() =>
98+
throttle(async (e: React.MouseEvent<HTMLDivElement>) => {
99+
// Skip hover events during drag selection
100+
if (editorEngine.state.isDragSelecting) {
101+
return;
102+
}
103+
if (
104+
editorEngine.state.editorMode === EditorMode.DESIGN ||
105+
((editorEngine.state.editorMode === EditorMode.INSERT_DIV ||
106+
editorEngine.state.editorMode === EditorMode.INSERT_TEXT ||
107+
editorEngine.state.editorMode === EditorMode.INSERT_IMAGE) &&
108+
!editorEngine.insert.isDrawing)
109+
) {
110+
await handleMouseEvent(e, MouseAction.MOVE);
111+
} else if (editorEngine.insert.isDrawing) {
112+
editorEngine.insert.draw(e);
113+
}
114+
}, 16),
115+
[editorEngine.state.isDragSelecting, editorEngine.state.editorMode, editorEngine.insert.isDrawing, getRelativeMousePosition, handleMouseEvent],
114116
);
115117

116118
useEffect(() => {
@@ -155,14 +157,12 @@ export const GestureScreen = observer(({ frame, isResizing }: { frame: Frame, is
155157
}
156158

157159
const handleDragOver = async (e: React.DragEvent<HTMLDivElement>) => {
158-
// Disabled drag and drop functionality
159160
e.preventDefault();
160161
e.stopPropagation();
161162
await handleMouseEvent(e, MouseAction.MOVE);
162163
};
163164

164165
const handleDrop = async (e: React.DragEvent<HTMLDivElement>) => {
165-
// Disabled drag and drop functionality
166166
e.preventDefault();
167167
e.stopPropagation();
168168

apps/web/client/src/components/store/editor/insert/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export class InsertManager {
9595
const origin = getRelativeMousePositionToFrameView(e, frameView);
9696
await this.insertElement(frameView, newRect, origin);
9797
this.drawOrigin = undefined;
98+
this.editorEngine.state.editorMode = EditorMode.DESIGN;
9899
}
99100

100101
private updateInsertRect(pos: ElementPosition) {

0 commit comments

Comments
 (0)