From f44ea90da61f5f3982022b6570124550ac5fb2d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mime=20=C4=8Cuvalo?= Date: Wed, 17 Apr 2024 14:16:22 +0100 Subject: [PATCH] arrows: still use Dist instead of Dist2 (#3511) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A little regression from https://github.com/tldraw/tldraw/pull/3454. We still need the exact distance here. ### Change Type - [x] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff - [x] `bugfix` — Bug fix - [ ] `feature` — New feature - [ ] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Release Notes - Fix arrow label positioning --- .../lib/tools/SelectTool/childStates/PointingArrowLabel.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/tldraw/src/lib/tools/SelectTool/childStates/PointingArrowLabel.ts b/packages/tldraw/src/lib/tools/SelectTool/childStates/PointingArrowLabel.ts index 1509d1935..fd84f09c0 100644 --- a/packages/tldraw/src/lib/tools/SelectTool/childStates/PointingArrowLabel.ts +++ b/packages/tldraw/src/lib/tools/SelectTool/childStates/PointingArrowLabel.ts @@ -92,8 +92,8 @@ export class PointingArrowLabel extends StateNode { let nextLabelPosition if (info.isStraight) { // straight arrows - const lineLength = Vec.Dist2(info.start.point, info.end.point) - const segmentLength = Vec.Dist2(info.end.point, nearestPoint) + const lineLength = Vec.Dist(info.start.point, info.end.point) + const segmentLength = Vec.Dist(info.end.point, nearestPoint) nextLabelPosition = 1 - segmentLength / lineLength } else { const { _center, measure, angleEnd, angleStart } = groupGeometry.children[0] as Arc2d