From 86543619e8603f5fefaab480a733dbaeeb9834e7 Mon Sep 17 00:00:00 2001 From: Alessio Davoli Date: Tue, 12 Dec 2023 19:08:56 +0100 Subject: [PATCH] Update map render --- frontend/src/lib/components/tabs/MapTab.svelte | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/lib/components/tabs/MapTab.svelte b/frontend/src/lib/components/tabs/MapTab.svelte index 562c142..28cbfbd 100644 --- a/frontend/src/lib/components/tabs/MapTab.svelte +++ b/frontend/src/lib/components/tabs/MapTab.svelte @@ -12,6 +12,9 @@ let longitude; let accuracy; const errorMessage = "Geolocation not available"; + const attribution = '© OpenStreetMap contributors'; + const openStreetMapTile = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'; + let errored = false; const watchPosition = async () => { @@ -59,15 +62,11 @@ }); map.setView(pianelloCoordinates, 13); - map.setMaxBounds(map.getBounds()); leaflet - .tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: - '© OpenStreetMap contributors' - }) - .addTo(map); + .tileLayer(openStreetMapTile, {attribution}) + .addTo(map); } onMount(async () => { @@ -83,10 +82,11 @@ } }); + {#if !errored} -
+
{:else} -{errorMessage} + {errorMessage} {/if}