From 0bf33a4bf6dee781a29705d1c28489b9f6659ecc Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Thu, 9 May 2024 10:52:00 -0700 Subject: [PATCH] [v11.0.x] Canvas: Fix bug for connection first vertex (#87569) Canvas: Fix bug for connection first vertex (#87534) (cherry picked from commit 06a27911a431b086022fd05ff5dfeae6f1a05dea) Co-authored-by: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com> --- .../canvas/components/connections/ConnectionSVG.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/public/app/plugins/panel/canvas/components/connections/ConnectionSVG.tsx b/public/app/plugins/panel/canvas/components/connections/ConnectionSVG.tsx index b22327c5441..e44a62c983e 100644 --- a/public/app/plugins/panel/canvas/components/connections/ConnectionSVG.tsx +++ b/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); }