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
This commit is contained in:
parent
089246def8
commit
1f7729c509
1 changed files with 9 additions and 4 deletions
|
|
@ -200,6 +200,9 @@ function FlowEditor() {
|
|||
const onCanvasDoubleClick = useCallback(
|
||||
(e: ReactMouseEvent<HTMLDivElement>) => {
|
||||
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() {
|
|||
</div>
|
||||
|
||||
<p className="text-[10px] text-zinc-500">
|
||||
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).
|
||||
</p>
|
||||
|
||||
{contextMenu && (
|
||||
|
|
|
|||
Loading…
Reference in a new issue