From 46bafa9fff66e1cc9f84061fb3bc3d65ce2fcb1f Mon Sep 17 00:00:00 2001 From: vcoppe Date: Fri, 12 Jul 2024 18:25:52 +0200 Subject: [PATCH] set bounds once map is loaded --- website/src/lib/stores.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/website/src/lib/stores.ts b/website/src/lib/stores.ts index b053fd26..4349d24b 100644 --- a/website/src/lib/stores.ts +++ b/website/src/lib/stores.ts @@ -81,10 +81,14 @@ targetMapBounds.subscribe((bounds) => { return; } - get(map)?.fitBounds(bounds.bounds, { - padding: 80, - linear: true, - easing: () => 1 + map.subscribe((m) => { + if (m) { + m.fitBounds(bounds.bounds, { + padding: 80, + linear: true, + easing: () => 1 + }); + } }); });