fix: lint & build issue

This commit is contained in:
Ashish Jain
2024-07-15 11:48:46 +02:00
parent 7a45ed8733
commit 8950fb1795

View File

@@ -145,11 +145,14 @@ const drawNodes = async (relX, relY, nodeArray, svg, subgraphsEl, depth) => {
} }
}) })
); );
nodeArray.forEach(function (node) {
if (node?.isGroup) { await Promise.all(
await drawNodes(relX + node.x, relY + node.y, node.children, svg, subgraphsEl, depth + 1); nodeArray.map(async function (node) {
} if (node?.isGroup) {
}); await drawNodes(relX + node.x, relY + node.y, node.children, svg, subgraphsEl, depth + 1);
}
})
);
}; };
const getNextPort = (node, edgeDirection, graphDirection) => { const getNextPort = (node, edgeDirection, graphDirection) => {
@@ -715,20 +718,20 @@ function intersectLine(p1, p2, q1, q2) {
// Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994, // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
// p7 and p473. // p7 and p473.
const a1, a2, b1, b2, c1, c2; // let a1, a2, b1, b2, c1, c2;
const r1, r2, r3, r4; // let r1, r2, r3, r4;
const denom, offset, num; // let denom, offset, num;
const x, y; // let x, y;
// Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x + // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
// b1 y + c1 = 0. // b1 y + c1 = 0.
a1 = p2.y - p1.y; const a1 = p2.y - p1.y;
b1 = p1.x - p2.x; const b1 = p1.x - p2.x;
c1 = p2.x * p1.y - p1.x * p2.y; const c1 = p2.x * p1.y - p1.x * p2.y;
// Compute r3 and r4. // Compute r3 and r4.
r3 = a1 * q1.x + b1 * q1.y + c1; const r3 = a1 * q1.x + b1 * q1.y + c1;
r4 = a1 * q2.x + b1 * q2.y + c1; const r4 = a1 * q2.x + b1 * q2.y + c1;
// Check signs of r3 and r4. If both point 3 and point 4 lie on // Check signs of r3 and r4. If both point 3 and point 4 lie on
// same side of line 1, the line segments do not intersect. // same side of line 1, the line segments do not intersect.
@@ -737,13 +740,13 @@ function intersectLine(p1, p2, q1, q2) {
} }
// Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0 // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0
a2 = q2.y - q1.y; const a2 = q2.y - q1.y;
b2 = q1.x - q2.x; const b2 = q1.x - q2.x;
c2 = q2.x * q1.y - q1.x * q2.y; const c2 = q2.x * q1.y - q1.x * q2.y;
// Compute r1 and r2 // Compute r1 and r2
r1 = a2 * p1.x + b2 * p1.y + c2; const r1 = a2 * p1.x + b2 * p1.y + c2;
r2 = a2 * p2.x + b2 * p2.y + c2; const r2 = a2 * p2.x + b2 * p2.y + c2;
// Check signs of r1 and r2. If both point 1 and point 2 lie // Check signs of r1 and r2. If both point 1 and point 2 lie
// on same side of second line segment, the line segments do // on same side of second line segment, the line segments do
@@ -753,21 +756,21 @@ function intersectLine(p1, p2, q1, q2) {
} }
// Line segments intersect: compute intersection point. // Line segments intersect: compute intersection point.
denom = a1 * b2 - a2 * b1; const denom = a1 * b2 - a2 * b1;
if (denom === 0) { if (denom === 0) {
return /*COLLINEAR*/; return /*COLLINEAR*/;
} }
offset = Math.abs(denom / 2); const offset = Math.abs(denom / 2);
// The denom/2 is to get rounding instead of truncating. It // The denom/2 is to get rounding instead of truncating. It
// is added or subtracted to the numerator, depending upon the // is added or subtracted to the numerator, depending upon the
// sign of the numerator. // sign of the numerator.
num = b1 * c2 - b2 * c1; num = b1 * c2 - b2 * c1;
x = num < 0 ? (num - offset) / denom : (num + offset) / denom; const x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
num = a2 * c1 - a1 * c2; num = a2 * c1 - a1 * c2;
y = num < 0 ? (num - offset) / denom : (num + offset) / denom; const y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
return { x: x, y: y }; return { x: x, y: y };
} }