mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(editor): Fix node insert position on new canvas (no-changelog) (#10495)
This commit is contained in:
parent
dc7dc995d5
commit
ab76b106fd
|
@ -980,11 +980,12 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
|
|
||||||
// If added node is a trigger and it's the first one added to the canvas
|
// If added node is a trigger and it's the first one added to the canvas
|
||||||
// we place it at canvasAddButtonPosition to replace the canvas add button
|
// we place it at canvasAddButtonPosition to replace the canvas add button
|
||||||
const position =
|
const position = (
|
||||||
nodeTypesStore.isTriggerNode(node.type) && triggerNodes.value.length === 0
|
nodeTypesStore.isTriggerNode(node.type) && triggerNodes.value.length === 0
|
||||||
? canvasStore.canvasAddButtonPosition
|
? [0, 0]
|
||||||
: // If no node is active find a free spot
|
: // If no node is active find a free spot
|
||||||
(lastClickPosition.value as XYPosition);
|
lastClickPosition.value
|
||||||
|
) as XYPosition;
|
||||||
|
|
||||||
return NodeViewUtils.getNewNodePosition(workflowsStore.allNodes, position);
|
return NodeViewUtils.getNewNodePosition(workflowsStore.allNodes, position);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue