전략편집기 수정

This commit is contained in:
Macbook
2026-06-14 23:56:27 +09:00
parent 198ebbb3d7
commit 55a517ba1c
5 changed files with 163 additions and 13 deletions
@@ -1281,16 +1281,22 @@ function StrategyEditorCanvasInner({
updatePreviewRef.current = updateDropPreview;
const resolveDropFromClientRef = useRef(resolveDropFromClient);
resolveDropFromClientRef.current = resolveDropFromClient;
const lastPreviewAnchorRef = useRef<string | null>(null);
useEffect(() => {
if (!needsPointerPaletteDrag()) return;
return subscribePaletteDrag((ev: PaletteDragEvent) => {
if (ev.phase === 'move') {
if (!isOverStrategyBuilder(ev.x, ev.y)) {
clearPreviewRef.current();
if (lastPreviewAnchorRef.current != null) {
lastPreviewAnchorRef.current = null;
clearPreviewRef.current();
}
return;
}
const { flowPos, anchorId } = resolveDropFromClientRef.current(ev.x, ev.y);
if (anchorId === lastPreviewAnchorRef.current) return;
lastPreviewAnchorRef.current = anchorId;
if (anchorId) {
updatePreviewRef.current(anchorId, flowPos);
} else {
@@ -1298,6 +1304,9 @@ function StrategyEditorCanvasInner({
}
return;
}
if (ev.phase === 'end' || ev.phase === 'cancel') {
lastPreviewAnchorRef.current = null;
}
if (ev.phase === 'cancel') {
clearPreviewRef.current();
}