mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-28 22:19:41 -08:00
add stub offset back
This commit is contained in:
parent
1779330572
commit
9596bb850d
|
@ -36,6 +36,7 @@
|
||||||
totalLength = 0,
|
totalLength = 0,
|
||||||
segmentProportions = [],
|
segmentProportions = [],
|
||||||
segmentProportionalLengths = [],
|
segmentProportionalLengths = [],
|
||||||
|
indexOffset = params.indexOffset,
|
||||||
stub = params.stub || 0,
|
stub = params.stub || 0,
|
||||||
sourceStub = _ju.isArray(stub) ? stub[0] : stub,
|
sourceStub = _ju.isArray(stub) ? stub[0] : stub,
|
||||||
targetStub = _ju.isArray(stub) ? stub[1] : stub,
|
targetStub = _ju.isArray(stub) ? stub[1] : stub,
|
||||||
|
@ -230,11 +231,16 @@
|
||||||
to[oIndex] = 0;
|
to[oIndex] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sx = swapX ? w + (sourceGap * so[0]) : sourceGap * so[0],
|
const sx = swapX ? w + (sourceGap * so[0]) : sourceGap * so[0],
|
||||||
sy = swapY ? h + (sourceGap * so[1]) : sourceGap * so[1],
|
sy = swapY ? h + (sourceGap * so[1]) : sourceGap * so[1],
|
||||||
tx = swapX ? targetGap * to[0] : w + (targetGap * to[0]),
|
tx = swapX ? targetGap * to[0] : w + (targetGap * to[0]),
|
||||||
ty = swapY ? targetGap * to[1] : h + (targetGap * to[1]),
|
ty = swapY ? targetGap * to[1] : h + (targetGap * to[1]),
|
||||||
oProduct = ((so[0] * to[0]) + (so[1] * to[1]));
|
oProduct = ((so[0] * to[0]) + (so[1] * to[1])),
|
||||||
|
sourceIndex = params.sourceEndpoint && params.sourceEndpoint.__meta ? params.sourceEndpoint.__meta.index : 0,
|
||||||
|
targetIndex = params.targetEndpoint && params.targetEndpoint.__meta ? params.targetEndpoint.__meta.index : 0;
|
||||||
|
|
||||||
|
const sourceStubWithOffset = sourceStub + sourceIndex * indexOffset;
|
||||||
|
const targetStubWithOffset = targetStub + targetIndex * indexOffset;
|
||||||
|
|
||||||
var result = {
|
var result = {
|
||||||
sx: sx, sy: sy, tx: tx, ty: ty, lw: lw,
|
sx: sx, sy: sy, tx: tx, ty: ty, lw: lw,
|
||||||
|
@ -244,18 +250,18 @@
|
||||||
my: (sy + ty) / 2,
|
my: (sy + ty) / 2,
|
||||||
so: so, to: to, x: x, y: y, w: w, h: h,
|
so: so, to: to, x: x, y: y, w: w, h: h,
|
||||||
segment: segment,
|
segment: segment,
|
||||||
startStubX: sx + (so[0] * sourceStub),
|
startStubX: sx + (so[0] * sourceStubWithOffset),
|
||||||
startStubY: sy + (so[1] * sourceStub),
|
startStubY: sy + (so[1] * sourceStubWithOffset),
|
||||||
endStubX: tx + (to[0] * targetStub),
|
endStubX: tx + (to[0] * targetStubWithOffset),
|
||||||
endStubY: ty + (to[1] * targetStub),
|
endStubY: ty + (to[1] * targetStubWithOffset),
|
||||||
isXGreaterThanStubTimes2: Math.abs(sx - tx) > (sourceStub + targetStub),
|
isXGreaterThanStubTimes2: Math.abs(sx - tx) > (sourceStubWithOffset + targetStubWithOffset),
|
||||||
isYGreaterThanStubTimes2: Math.abs(sy - ty) > (sourceStub + targetStub),
|
isYGreaterThanStubTimes2: Math.abs(sy - ty) > (sourceStubWithOffset + targetStubWithOffset),
|
||||||
opposite: oProduct === -1,
|
opposite: oProduct === -1,
|
||||||
perpendicular: oProduct === 0,
|
perpendicular: oProduct === 0,
|
||||||
orthogonal: oProduct === 1,
|
orthogonal: oProduct === 1,
|
||||||
sourceAxis: so[0] === 0 ? "y" : "x",
|
sourceAxis: so[0] === 0 ? "y" : "x",
|
||||||
points: [x, y, w, h, sx, sy, tx, ty ],
|
points: [x, y, w, h, sx, sy, tx, ty ],
|
||||||
stubs:[sourceStub, targetStub],
|
stubs:[sourceStubWithOffset, targetStubWithOffset],
|
||||||
};
|
};
|
||||||
result.anchorOrientation = result.opposite ? "opposite" : result.orthogonal ? "orthogonal" : "perpendicular";
|
result.anchorOrientation = result.opposite ? "opposite" : result.orthogonal ? "orthogonal" : "perpendicular";
|
||||||
return result;
|
return result;
|
||||||
|
@ -273,12 +279,12 @@
|
||||||
this.bounds.maxY = Math.max(this.bounds.maxY, segBounds.maxY);
|
this.bounds.maxY = Math.max(this.bounds.maxY, segBounds.maxY);
|
||||||
};
|
};
|
||||||
|
|
||||||
var dumpSegmentsToConsole = function () {
|
// var dumpSegmentsToConsole = function () {
|
||||||
console.log("SEGMENTS:");
|
// console.log("SEGMENTS:");
|
||||||
for (var i = 0; i < segments.length; i++) {
|
// for (var i = 0; i < segments.length; i++) {
|
||||||
console.log(segments[i].type, segments[i].getLength(), segmentProportions[i]);
|
// console.log(segments[i].type, segments[i].getLength(), segmentProportions[i]);
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
this.pointOnPath = function (location, absolute) {
|
this.pointOnPath = function (location, absolute) {
|
||||||
var seg = _findSegmentForLocation(location, absolute);
|
var seg = _findSegmentForLocation(location, absolute);
|
||||||
|
@ -331,6 +337,7 @@
|
||||||
this.type = "N8nFlowchart";
|
this.type = "N8nFlowchart";
|
||||||
params = params || {};
|
params = params || {};
|
||||||
params.stub = params.stub == null ? 30 : params.stub;
|
params.stub = params.stub == null ? 30 : params.stub;
|
||||||
|
params.indexOffset = params.indexOffset == null ? 5 : params.indexOffset;
|
||||||
var segments,
|
var segments,
|
||||||
_super = _jp.Connectors.N8nAbstractConnector.apply(this, arguments),
|
_super = _jp.Connectors.N8nAbstractConnector.apply(this, arguments),
|
||||||
midpoint = params.midpoint == null ? 0.5 : params.midpoint,
|
midpoint = params.midpoint == null ? 0.5 : params.midpoint,
|
||||||
|
|
|
@ -47,8 +47,9 @@ export const CONNECTOR_FLOWCHART_TYPE = ['N8nFlowchart', {
|
||||||
stub: JSPLUMB_FLOWCHART_STUB + 10,
|
stub: JSPLUMB_FLOWCHART_STUB + 10,
|
||||||
gap: 5,
|
gap: 5,
|
||||||
alwaysRespectStubs: true,
|
alwaysRespectStubs: true,
|
||||||
yOffset: NODE_SIZE,
|
yOffset: NODE_SIZE, // length of vertical segment when looping
|
||||||
loopbackMinimum: 140,
|
loopbackMinimum: 140, // minimum length before flowchart loops around
|
||||||
|
indexOffset: 10, // stub offset between different endpoints of same node
|
||||||
}];
|
}];
|
||||||
|
|
||||||
export const CONNECTOR_PAINT_STYLE_DEFAULT: PaintStyle = {
|
export const CONNECTOR_PAINT_STYLE_DEFAULT: PaintStyle = {
|
||||||
|
|
Loading…
Reference in a new issue