diff --git a/web-frontend/src/lib/Map.svelte b/web-frontend/src/lib/Map.svelte index fd21838..6f62600 100644 --- a/web-frontend/src/lib/Map.svelte +++ b/web-frontend/src/lib/Map.svelte @@ -9,15 +9,25 @@ let locationChecked; let locationControl; + export let isVisible = true; export let onMapClick = () => {}; export let map; + $: if (isVisible) { + locationCheckedChanged(false); + } + const locationCheckedChanged = (setValue) => { + if (!map) { + return; + } if (setValue === true || setValue === false) { // Shortcut to set it in this function, if they passed a boolean locationChecked = !!setValue; } + console.log('Setting chceked to ', setValue); + if (locationChecked) { map.locate({ setView: true, watch: true, enableHighAccuracy: true }); } else { @@ -103,7 +113,7 @@ }); -