mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 04:47:29 -08:00
⚡ Update looping (#2468)
* update loops * set final values * update loop behavior
This commit is contained in:
parent
91bafb4860
commit
889921f5fe
|
@ -676,12 +676,12 @@
|
||||||
|
|
||||||
const diffX = paintInfo.endStubX - paintInfo.startStubX;
|
const diffX = paintInfo.endStubX - paintInfo.startStubX;
|
||||||
const diffY = paintInfo.endStubY - paintInfo.startStubY;
|
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),
|
var midx = paintInfo.startStubX + ((paintInfo.endStubX - paintInfo.startStubX) * midpoint),
|
||||||
midy;
|
midy;
|
||||||
|
|
||||||
if (diffX < (-1 * loopbackMinimum)) {
|
if (diffY >= 0 || diffX < (-1 * loopbackMinimum)) {
|
||||||
// loop backward behavior
|
// loop backward behavior
|
||||||
midy = paintInfo.startStubY - (diffX < 0 ? direction * loopbackVerticalLength : 0);
|
midy = paintInfo.startStubY - (diffX < 0 ? direction * loopbackVerticalLength : 0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -52,7 +52,7 @@ export const CONNECTOR_FLOWCHART_TYPE = ['N8nCustom', {
|
||||||
stub: JSPLUMB_FLOWCHART_STUB + 10,
|
stub: JSPLUMB_FLOWCHART_STUB + 10,
|
||||||
targetGap: 4,
|
targetGap: 4,
|
||||||
alwaysRespectStubs: false,
|
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
|
loopbackMinimum: LOOPBACK_MINIMUM, // minimum length before flowchart loops around
|
||||||
getEndpointOffset(endpoint: Endpoint) {
|
getEndpointOffset(endpoint: Endpoint) {
|
||||||
const indexOffset = 10; // stub offset between different endpoints of same node
|
const indexOffset = 10; // stub offset between different endpoints of same node
|
||||||
|
|
Loading…
Reference in a new issue