in karavan-space/src/designer/route/DslConnections.tsx [264:369]
getInternalLine(uri: string, key: string, className: string, fromX: number, fromY: number, r: number, i: number) {
const target = Array.from(this.state.steps.values())
.filter(s => s.step.dslName === 'FromDefinition')
.filter(s => (s.step as any).uri && (s.step as any).uri === uri)[0];
if (target) {
const targetX = target.headerRect.x + target.headerRect.width / 2 - this.props.left;
const targetY = target.headerRect.y + target.headerRect.height / 2 - this.props.top;
const gap = 100;
const add = 0.2;
// right
if (targetX - fromX >= gap) {
const startX = fromX + r;
const startY = fromY;
const endX = targetX - r * 2 + 4;
const endY = targetY;
const coefX = 24 + (i * add);
const coefY = (targetY > fromY) ? 24 : -24;
const pointX1 = startX + coefX;
const pointY1 = startY;
const pointX2 = startX + coefX;
const pointY2 = startY + coefY;
const pointLX = pointX1;
const pointLY = targetY - coefY;
const pointX3 = pointLX;
const pointY3 = endY;
const pointX4 = pointLX + coefX;
const pointY4 = endY;
return this.getInternalPath(key, className, startX, startY, pointX1, pointY1, pointX2, pointY2, pointLX, pointLY, pointX3, pointY3, pointX4, pointY4, endX, endY);
} else if (targetX > fromX && targetX - fromX < gap) {
const startX = fromX - r;
const startY = fromY;
const endX = targetX - r * 2 + 4;
const endY = targetY;
const coefX = -24 - (i * add);
const coefY = (targetY > fromY) ? 24 : -24;
const pointX1 = startX + coefX;
const pointY1 = startY;
const pointX2 = startX + coefX;
const pointY2 = startY + coefY;
const pointLX = pointX1;
const pointLY = targetY - coefY;
const pointX3 = pointLX;
const pointY3 = endY;
const pointX4 = pointLX - coefX/2;
const pointY4 = endY;
return this.getInternalPath(key, className, startX, startY, pointX1, pointY1, pointX2, pointY2, pointLX, pointLY, pointX3, pointY3, pointX4, pointY4, endX, endY);
} else if (targetX <= fromX && fromX - targetX < gap) {
const startX = fromX + r;
const startY = fromY;
const endX = targetX + r * 2 - 4;
const endY = targetY;
const coefX = 24 + (i * add);
const coefY = (targetY > fromY) ? 24 : -24;
const pointX1 = startX + coefX;
const pointY1 = startY;
const pointX2 = startX + coefX;
const pointY2 = startY + coefY;
const pointLX = pointX1;
const pointLY = targetY - coefY;
const pointX3 = pointLX;
const pointY3 = endY;
const pointX4 = pointLX - coefX/2;
const pointY4 = endY;
return this.getInternalPath(key, className, startX, startY, pointX1, pointY1, pointX2, pointY2, pointLX, pointLY, pointX3, pointY3, pointX4, pointY4, endX, endY);
} else {
const startX = fromX - r;
const startY = fromY;
const endX = targetX + r * 2 - 4;
const endY = targetY;
const coefX = -24 - (i * add);
const coefY = (targetY > fromY) ? 24 : -24;
const pointX1 = startX + coefX;
const pointY1 = startY;
const pointX2 = startX + coefX;
const pointY2 = startY + coefY;
const pointLX = pointX1;
const pointLY = targetY - coefY;
const pointX3 = pointLX;
const pointY3 = endY;
const pointX4 = pointLX + coefX;
const pointY4 = endY;
return this.getInternalPath(key, className, startX, startY, pointX1, pointY1, pointX2, pointY2, pointLX, pointLY, pointX3, pointY3, pointX4, pointY4, endX, endY);
}
}
}