10 * @param {"right" | "left" | string} forceDirection
13 public static makeConnectionPath(x1: any, y1: any, x2: any, y2: any, forceDirection: "right" | "left" | string = "right"): string | undefined {
15 if (!forceDirection) {
16 return `M ${x1} ${y1} C ${(x1 + x2) / 2} ${y1} ${(x1 + x2) / 2} ${y2} ${x2} ${y2}`;
17 } else if (forceDirection === "right") {
18 const outDir = x1 + Math.abs(x1 - x2) / 2;
19 const inDir = x2 - Math.abs(x1 - x2) / 2;
21 return `M ${x1} ${y1} C ${outDir} ${y1} ${inDir} ${y2} ${x2} ${y2}`;
22 } else if (forceDirection === "left") {
23 const outDir = x1 - Math.abs(x1 - x2) / 2;
24 const inDir = x2 + Math.abs(x1 - x2) / 2;
26 return `M ${x1} ${y1} C ${outDir} ${y1} ${inDir} ${y2} ${x2} ${y2}`;