전략편집기 전략컨트롤 드래그

This commit is contained in:
Macbook
2026-06-15 01:28:56 +09:00
parent b0e2efd7cb
commit 3150dc8af6
7 changed files with 35 additions and 22 deletions
+15 -3
View File
@@ -1,5 +1,9 @@
import type { ReactFlowInstance } from '@xyflow/react';
import { getLastHtmlPaletteDragClientXY, isPaletteHtmlDragActive } from './paletteDragSession';
import {
getActivePaletteDrag,
getLastHtmlPaletteDragClientXY,
isPaletteHtmlDragActive,
} from './paletteDragSession';
type FlowProjector = Pick<ReactFlowInstance, 'screenToFlowPosition' | 'getViewport'>;
@@ -93,8 +97,9 @@ export function isOverStrategyBuilder(clientX: number, clientY: number): boolean
/** DOM hit-test — react-flow 노드 id (Safari HTML5 drag: elementsFromPoint 불가 → rect 우선) */
export function findFlowNodeIdAtClientPoint(clientX: number, clientY: number): string | null {
const pad = 10;
const nodeEls = document.querySelectorAll<HTMLElement>('.react-flow__node');
for (const nodeEl of nodeEls) {
const nodeEls = Array.from(document.querySelectorAll<HTMLElement>('.react-flow__node'));
for (let i = nodeEls.length - 1; i >= 0; i--) {
const nodeEl = nodeEls[i];
const rect = nodeEl.getBoundingClientRect();
if (
clientX >= rect.left - pad && clientX <= rect.right + pad
@@ -166,6 +171,13 @@ export function resolvePaletteDropClientPoint(
return { flowPos, anchorId: domId };
}
if (getActivePaletteDrag()) {
const flowHit = findAtFlow(flowPos, nodes);
if (flowHit && isConnectTarget(flowHit.id)) {
return { flowPos, anchorId: flowHit.id };
}
}
for (const node of nodes) {
if (!isConnectTarget(node.id)) continue;
const escaped = typeof CSS !== 'undefined' && CSS.escape
+3 -5
View File
@@ -7,7 +7,7 @@ import {
bindWindowDrag,
isPrimaryPointerButton,
} from './pointerDrag';
import { isDesktop, isMacDesktop } from './platform';
import { isDesktop } from './platform';
export type PaletteDragPayload = Record<string, unknown> & {
type: string;
@@ -96,10 +96,8 @@ function hasCoarsePointer(): boolean {
}
}
/** HTML5 DnD 대신 pointer/touch overlay 드래그 사용 (Windows Desktop 등) */
/** HTML5 DnD 대신 pointer/touch overlay 드래그 (Tauri Desktop 전체 — macOS WKWebView HTML5 DnD 불안정) */
export function needsPointerPaletteDrag(): boolean {
// macOS Tauri WKWebView — Safari 웹과 동일하게 HTML5 DnD 사용
if (isMacDesktop()) return false;
return isDesktop() || hasCoarsePointer();
}
@@ -279,7 +277,7 @@ function startPaletteDragGesture(
finishDrag('end', xy);
}
},
{ preventTouchScroll: true },
{ preventTouchScroll: true, useCapture: isDesktop() },
);
}
+1 -1
View File
@@ -368,7 +368,7 @@ export type EdgeHandleBinding = {
export const FLOW_NODE_W = 200;
export const FLOW_NODE_H = 72;
export const FLOW_START_W = 200;
export const FLOW_START_H = 78;
export const FLOW_START_H = 168;
function nodeCenter(
id: string,