Canvas: Fix bug for connection first vertex (#87534)

This commit is contained in:
Drew Slobodnjak 2024-05-09 09:17:23 -07:00 committed by GitHub
parent baed7d6dbe
commit 06a27911a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 5 deletions

View File

@ -217,14 +217,15 @@ export const ConnectionSVG = ({
} }
} else { } else {
// Last vertex // Last vertex
let previousVertex = { x: 0, y: 0 };
if (index > 0) { if (index > 0) {
// Not also the first vertex // Not also the first vertex
previousVertex = vertices[index - 1]; const previousVertex = vertices[index - 1];
const Xp = previousVertex.x * xDist + xStart;
const Yp = previousVertex.y * yDist + yStart;
angle1 = calculateAngle(Xp, Yp, X, Y);
} else {
angle1 = calculateAngle(x1, y1, X, Y);
} }
const Xp = previousVertex.x * xDist + xStart;
const Yp = previousVertex.y * yDist + yStart;
angle1 = calculateAngle(Xp, Yp, X, Y);
angle2 = calculateAngle(X, Y, x2, y2); angle2 = calculateAngle(X, Y, x2, y2);
} }