From 889921f5fe146508ed8de5615f7d5c91dbe6f634 Mon Sep 17 00:00:00 2001 From: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com> Date: Thu, 25 Nov 2021 18:38:00 +0100 Subject: [PATCH] :zap: Update looping (#2468) * update loops * set final values * update loop behavior --- packages/editor-ui/src/plugins/N8nCustomConnectorType.js | 4 ++-- packages/editor-ui/src/views/canvasHelpers.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/plugins/N8nCustomConnectorType.js b/packages/editor-ui/src/plugins/N8nCustomConnectorType.js index cdd59da666..73f2d656fc 100644 --- a/packages/editor-ui/src/plugins/N8nCustomConnectorType.js +++ b/packages/editor-ui/src/plugins/N8nCustomConnectorType.js @@ -676,12 +676,12 @@ const diffX = paintInfo.endStubX - paintInfo.startStubX; const diffY = paintInfo.endStubY - paintInfo.startStubY; - const direction = diffY >= 0 ? 1 : -1; // vertical direction of loop, above or below source + const direction = -1; // vertical direction of loop, always below source var midx = paintInfo.startStubX + ((paintInfo.endStubX - paintInfo.startStubX) * midpoint), midy; - if (diffX < (-1 * loopbackMinimum)) { + if (diffY >= 0 || diffX < (-1 * loopbackMinimum)) { // loop backward behavior midy = paintInfo.startStubY - (diffX < 0 ? direction * loopbackVerticalLength : 0); } else { diff --git a/packages/editor-ui/src/views/canvasHelpers.ts b/packages/editor-ui/src/views/canvasHelpers.ts index 6ecf8a66c5..3ea65dbcfe 100644 --- a/packages/editor-ui/src/views/canvasHelpers.ts +++ b/packages/editor-ui/src/views/canvasHelpers.ts @@ -52,7 +52,7 @@ export const CONNECTOR_FLOWCHART_TYPE = ['N8nCustom', { stub: JSPLUMB_FLOWCHART_STUB + 10, targetGap: 4, alwaysRespectStubs: false, - loopbackVerticalLength: NODE_SIZE, // height of vertical segment when looping + loopbackVerticalLength: NODE_SIZE + GRID_SIZE, // height of vertical segment when looping loopbackMinimum: LOOPBACK_MINIMUM, // minimum length before flowchart loops around getEndpointOffset(endpoint: Endpoint) { const indexOffset = 10; // stub offset between different endpoints of same node