전략편집기 전략컨트롤 드래그
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user