전략편집기 수정
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user