feat(editor): Improve insertion algorithm for nodes with multiple main outputs (no-changelog) (#11213)

This commit is contained in:
Alex Grozav
2024-10-11 17:03:58 +03:00
committed by GitHub
parent 98759701e4
commit c9628de72b
5 changed files with 121 additions and 67 deletions

View File

@@ -161,6 +161,7 @@ import {
getConnectorPaintStyleData,
OVERLAY_ENDPOINT_ARROW_ID,
getEndpointScope,
generateOffsets,
} from '@/utils/nodeViewUtils';
import { useViewStacks } from '@/components/Node/NodeCreator/composables/useViewStacks';
import { useExternalHooks } from '@/composables/useExternalHooks';
@@ -2275,12 +2276,6 @@ export default defineComponent({
);
if (sourceNodeType) {
const offsets = [
[-100, 100],
[-140, 0, 140],
[-240, -100, 100, 240],
];
const sourceNodeOutputs = NodeHelpers.getNodeOutputs(
workflow,
lastSelectedNode,
@@ -2293,7 +2288,11 @@ export default defineComponent({
);
if (sourceNodeOutputMainOutputs.length > 1) {
const offset = offsets[sourceNodeOutputMainOutputs.length - 2];
const offset = generateOffsets(
sourceNodeOutputMainOutputs.length,
NodeViewUtils.NODE_SIZE,
NodeViewUtils.GRID_SIZE,
);
const sourceOutputIndex = lastSelectedConnection.__meta
? lastSelectedConnection.__meta.sourceOutputIndex
: 0;