전략편집기 수정

This commit is contained in:
Macbook
2026-06-15 00:31:59 +09:00
parent f35f17df36
commit 78d9dca870
5 changed files with 49 additions and 43 deletions
@@ -32,8 +32,6 @@ import {
import { buildSidewaysFilterNode } from '../../utils/sidewaysFilterPaletteStorage';
import {
isPaletteHtmlDrag,
completePaletteDragAt,
getActivePaletteDrag,
needsPointerPaletteDrag,
readPaletteHtmlDragData,
setPaletteDragDropHandler,
@@ -1282,6 +1280,7 @@ function StrategyEditorCanvasInner({
const resolveDropFromClientRef = useRef(resolveDropFromClient);
resolveDropFromClientRef.current = resolveDropFromClient;
const lastPreviewAnchorRef = useRef<string | null>(null);
const lastPreviewKeyRef = useRef<string | null>(null);
useEffect(() => {
if (!needsPointerPaletteDrag()) return;
@@ -1290,13 +1289,18 @@ function StrategyEditorCanvasInner({
if (!isOverStrategyBuilder(ev.x, ev.y)) {
if (lastPreviewAnchorRef.current != null) {
lastPreviewAnchorRef.current = null;
lastPreviewKeyRef.current = null;
clearPreviewRef.current();
}
return;
}
const { flowPos, anchorId } = resolveDropFromClientRef.current(ev.x, ev.y);
if (anchorId === lastPreviewAnchorRef.current) return;
const previewKey = anchorId
? `${anchorId}:${Math.round(flowPos.x)}:${Math.round(flowPos.y)}`
: '';
if (previewKey === lastPreviewKeyRef.current) return;
lastPreviewAnchorRef.current = anchorId;
lastPreviewKeyRef.current = previewKey;
if (anchorId) {
updatePreviewRef.current(anchorId, flowPos);
} else {
@@ -1306,6 +1310,7 @@ function StrategyEditorCanvasInner({
}
if (ev.phase === 'end' || ev.phase === 'cancel') {
lastPreviewAnchorRef.current = null;
lastPreviewKeyRef.current = null;
}
if (ev.phase === 'cancel') {
clearPreviewRef.current();
@@ -1351,21 +1356,11 @@ function StrategyEditorCanvasInner({
}
}, [selectedNodeId, handleDelete, deleteSelectedNodes, handleDisconnectEdge]);
const handleCanvasPointerUp = useCallback((e: React.PointerEvent) => {
if (!needsPointerPaletteDrag()) return;
if (e.button !== 0) return;
if (!getActivePaletteDrag()) return;
e.preventDefault();
e.stopPropagation();
completePaletteDragAt(e.clientX, e.clientY);
}, []);
return (
<div
ref={canvasWrapRef}
className={`se-canvas-wrap se-canvas-wrap--${signalTab} se-canvas-wrap--${interactionMode}`}
onKeyDown={onKeyDown}
onPointerUpCapture={handleCanvasPointerUp}
tabIndex={0}
>
<ReactFlow