From 0810f339859f76b294d6750ee5c15ed30fe2d8f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mitja=20Bezen=C5=A1ek?= Date: Thu, 25 Apr 2024 18:14:44 +0200 Subject: [PATCH] Simplify --- .../ui/components/Minimap/MinimapManager.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/packages/tldraw/src/lib/ui/components/Minimap/MinimapManager.ts b/packages/tldraw/src/lib/ui/components/Minimap/MinimapManager.ts index 31db9ebae..89913db9a 100644 --- a/packages/tldraw/src/lib/ui/components/Minimap/MinimapManager.ts +++ b/packages/tldraw/src/lib/ui/components/Minimap/MinimapManager.ts @@ -186,22 +186,8 @@ export class MinimapManager { const ly = Math.max(0, minY + vpPageBounds.height - py) const ry = Math.max(0, -(maxY - vpPageBounds.height - py)) - const ql = Math.max(0, lx - rx) - const qr = Math.max(0, rx - lx) - const qt = Math.max(0, ly - ry) - const qb = Math.max(0, ry - ly) - - if (ql && ql > qr) { - px += ql / 2 - } else if (qr) { - px -= qr / 2 - } - - if (qt && qt > qb) { - py += qt / 2 - } else if (qb) { - py -= qb / 2 - } + px += (lx - rx) / 2 + py += (ly - ry) / 2 px = clamp(px, minX, maxX) py = clamp(py, minY, maxY)