fix(editor): Fix node insert position on new canvas (no-changelog) (#10495)

This commit is contained in:
Alex Grozav 2024-08-22 15:28:56 +03:00 committed by GitHub
parent dc7dc995d5
commit ab76b106fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
} }