fix(automations): reliably open a node's config when switching nodes
A click with a few px of jitter crossed Vue Flow's 1px drag threshold and was treated as a drag, so onNodeClick never fired and the config panel didn't switch between nodes. Raise nodeDragThreshold to 5 so normal clicks stay clicks, and also select the node on drag start as a safety net.
This commit is contained in:
parent
109ad7dfc0
commit
b2932262cf
1 changed files with 6 additions and 0 deletions
|
|
@ -206,6 +206,11 @@ onConnect((connection: Connection) => {
|
|||
let dragStartPosition: XYPosition | null = null;
|
||||
onNodeDragStart(({ node }) => {
|
||||
dragStartPosition = { ...node.position };
|
||||
// A click that moves more than Vue Flow's drag threshold (1px) registers as a
|
||||
// drag, not a click, so onNodeClick never fires. Select here too, otherwise
|
||||
// switching between nodes intermittently fails to open the grabbed node's config.
|
||||
selectedNodeId.value = node.id;
|
||||
selectedEdgeId.value = null;
|
||||
});
|
||||
onNodeDragStop(({ node }) => {
|
||||
if (!dragStartPosition) return;
|
||||
|
|
@ -483,6 +488,7 @@ const defaultEdgeOptions = {
|
|||
:default-edge-options="defaultEdgeOptions"
|
||||
:connection-mode="ConnectionMode.Loose"
|
||||
:delete-key-code="null"
|
||||
:node-drag-threshold="5"
|
||||
:snap-to-grid="true"
|
||||
:snap-grid="[16, 16]"
|
||||
fit-view-on-init
|
||||
|
|
|
|||
Loading…
Reference in a new issue