From 2bcbf1eada9f7a2879315f08c3a4c8e7d9e2412d Mon Sep 17 00:00:00 2001 From: vcoppe Date: Wed, 17 Jul 2024 23:47:55 +0200 Subject: [PATCH] avoid zooming on first file point --- website/src/lib/stores.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/src/lib/stores.ts b/website/src/lib/stores.ts index efa7ee60..68f5a132 100644 --- a/website/src/lib/stores.ts +++ b/website/src/lib/stores.ts @@ -73,7 +73,7 @@ const targetMapBounds = writable({ }); derived([targetMapBounds, map], x => x).subscribe(([bounds, $map]) => { - if ($map === null || bounds.count !== bounds.total) { + if ($map === null || bounds.count !== bounds.total || (bounds.bounds.getSouth() === 90 && bounds.bounds.getWest() === 180 && bounds.bounds.getNorth() === -90 && bounds.bounds.getEast() === -180)) { return; } @@ -110,6 +110,10 @@ export function updateTargetMapBounds(bounds: { northEast: Coordinates }) { if (bounds.southWest.lat == 90 && bounds.southWest.lon == 180 && bounds.northEast.lat == -90 && bounds.northEast.lon == -180) { // Avoid update for empty (new) files + targetMapBounds.update((target) => { + target.count += 1; + return target; + }); return; }