[v11.0.x] Canvas: Fix bug for connection first vertex (#87569)

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

(cherry picked from commit 06a27911a4)

Co-authored-by: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com>
pull/87581/head
grafana-delivery-bot[bot] 1 year ago committed by GitHub
parent bda261b744
commit 0bf33a4bf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      public/app/plugins/panel/canvas/components/connections/ConnectionSVG.tsx

@ -221,14 +221,15 @@ export const ConnectionSVG = ({
}
} else {
// Last vertex
let previousVertex = { x: 0, y: 0 };
if (index > 0) {
// 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);
}

Loading…
Cancel
Save