From 1f7729c50953577a929e28cbb09975d8406f7c43 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Tue, 6 Oct 2026 13:56:46 -0400 Subject: [PATCH] feat(npc-dialogue): select nodes on click, edit on double-click - Single click now only selects a node; the edit dialog opens on double-click so the Del-to-delete flow is never interrupted by a modal - Guard the canvas double-click handler so double-clicking a node can never also spawn a new dialogue node behind the dialog - Update the editor hint text to describe the new click model --- .../admin/npc-dialogue/NpcDialogueEditor.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/admin/npc-dialogue/NpcDialogueEditor.tsx b/src/components/admin/npc-dialogue/NpcDialogueEditor.tsx index 6793a133..8ab2eda6 100644 --- a/src/components/admin/npc-dialogue/NpcDialogueEditor.tsx +++ b/src/components/admin/npc-dialogue/NpcDialogueEditor.tsx @@ -200,6 +200,9 @@ function FlowEditor() { const onCanvasDoubleClick = useCallback( (e: ReactMouseEvent) => { const target = e.target as HTMLElement; + // Node double-clicks open the edit dialog (onNodeDoubleClick); they + // must never also spawn a new node. + if (target.closest?.(".react-flow__node")) return; if (!target.closest?.(".react-flow__pane")) return; const pos = rf.screenToFlowPosition({ x: e.clientX, y: e.clientY }); addNode("dialogue", pos); @@ -452,7 +455,8 @@ function FlowEditor() { applyConnection(sourceId, targetId, connectionState.fromHandle?.id); }} isValidConnection={isValidConnection} - onNodeClick={(_e, node) => setEditingNodeId(node.id)} + // Single click selects (React Flow default); double-click edits. + onNodeDoubleClick={(_e, node) => setEditingNodeId(node.id)} onNodeContextMenu={onNodeContextMenu} onPaneClick={onPaneClick} onPaneContextMenu={onPaneContextMenu} @@ -473,9 +477,10 @@ function FlowEditor() {

- Click a node to edit. Select and press Del (or right-click) to delete. Double-click the - canvas for a new dialogue node; right-click it for any type. Drag a row's dot to wire - that exact choice or branch. Use Expand to fill the screen (Esc to shrink). + Click a node to select it, double-click to edit. Select and press Del (or right-click) to + delete. Double-click the canvas for a new dialogue node; right-click it for any type. Drag + a row's dot to wire that exact choice or branch. Use Expand to fill the screen (Esc to + shrink).

{contextMenu && (