diff --git a/M01_MasterData/SheetLogic/M01_SL_Diagram.ts b/M01_MasterData/SheetLogic/M01_SL_Diagram.ts index c32d15315..f9bbf1801 100644 --- a/M01_MasterData/SheetLogic/M01_SL_Diagram.ts +++ b/M01_MasterData/SheetLogic/M01_SL_Diagram.ts @@ -129,6 +129,8 @@ interface HostState { pill: { node: string; pill: string; dir: "in" | "out" } | null; note: string; scroll: number; + /** 선 다시 그리기 — 띠 크기 바뀜 */ + watch?: ResizeObserver; } const states = new WeakMap(); @@ -159,6 +161,7 @@ export function renderDiagram( const select = (id: string | null): void => { st.selected = id; st.pill = null; + st.note = ""; on.select(id); redraw(); }; @@ -455,7 +458,11 @@ export function renderDiagram( svg.append(g); } }; - requestAnimationFrame(drawLines); + // 붙어 있으면 바로 · 나중에 붙거나 크기가 바뀌면 다시(띠 밀기 · 창 크기) + st.watch?.disconnect(); + st.watch = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(drawLines); + st.watch?.observe(inner); + if (inner.isConnected) drawLines(); /* 끌어 잇기 */ function startDrag(ev: PointerEvent, from: SlEnd): void { @@ -494,8 +501,10 @@ export function renderDiagram( : boxHit ? { node: boxHit.dataset.node ?? "", pill: null, dir: null } : null; - // 끈 뒤 따라오는 click 을 한 번 삼킴 - window.addEventListener("click", (c) => c.stopPropagation(), { capture: true, once: true }); + // 끈 뒤 바로 따라오는 click 만 삼킴 — 안 오면 곧 풀어 다음 누름은 그대로 + const swallow = (c: MouseEvent): void => c.stopPropagation(); + window.addEventListener("click", swallow, { capture: true, once: true }); + setTimeout(() => window.removeEventListener("click", swallow, { capture: true }), 0); tryConnect(from, target); }; window.addEventListener("pointermove", move);