mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-28 22:19:41 -08:00
push nodes up / down in case of if node
This commit is contained in:
parent
ca0d856d36
commit
b121f8e07e
|
@ -1334,7 +1334,7 @@ export default mixins(
|
||||||
parameters: {},
|
parameters: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if there is a last selected node
|
// when pulling new connection from node or injecting into a connection
|
||||||
const lastSelectedNode = this.lastSelectedNode;
|
const lastSelectedNode = this.lastSelectedNode;
|
||||||
if (lastSelectedNode) {
|
if (lastSelectedNode) {
|
||||||
const lastSelectedConnection = this.lastSelectedConnection;
|
const lastSelectedConnection = this.lastSelectedConnection;
|
||||||
|
@ -1350,11 +1350,21 @@ export default mixins(
|
||||||
this.newNodeInsertPosition = null;
|
this.newNodeInsertPosition = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
let yOffset = 0;
|
||||||
|
|
||||||
|
if (lastSelectedConnection) {
|
||||||
|
const sourceNodeType = this.$store.getters.nodeType(lastSelectedNode.type);
|
||||||
|
if (sourceNodeType && sourceNodeType.outputs.length === 2) {
|
||||||
|
const offsets = [-100, 100];
|
||||||
|
yOffset = offsets[lastSelectedConnection.__meta.sourceOutputIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If a node is active then add the new node directly after the current one
|
// If a node is active then add the new node directly after the current one
|
||||||
// newNodeData.position = [activeNode.position[0], activeNode.position[1] + 60];
|
// newNodeData.position = [activeNode.position[0], activeNode.position[1] + 60];
|
||||||
newNodeData.position = getNewNodePosition(
|
newNodeData.position = getNewNodePosition(
|
||||||
this.nodes,
|
this.nodes,
|
||||||
[lastSelectedNode.position[0] + 200, lastSelectedNode.position[1]],
|
[lastSelectedNode.position[0] + 200, lastSelectedNode.position[1] + yOffset],
|
||||||
[100, 0],
|
[100, 0],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue