From 9b60c4437cfe1461b35a2166b861ae43226b89da Mon Sep 17 00:00:00 2001 From: Alessio Davoli Date: Wed, 13 Dec 2023 18:47:39 +0100 Subject: [PATCH] On each iteration add marker to map --- frontend/src/lib/components/tabs/MapTab.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/tabs/MapTab.svelte b/frontend/src/lib/components/tabs/MapTab.svelte index b1a5ba2..2021fdf 100644 --- a/frontend/src/lib/components/tabs/MapTab.svelte +++ b/frontend/src/lib/components/tabs/MapTab.svelte @@ -38,7 +38,11 @@ latitude = crd.latitude; longitude = crd.longitude; accuracy = crd.accuracy; - + + const userMarker = leaflet.marker([latitude, longitude]).addTo(map); + // move the map to have the location in its center + map.panTo(userMarker.getLatLng()); + string += "Your current position is:"; string += `Latitude : ${crd.latitude}`; string += `Longitude: ${crd.longitude}`;