Compare commits
2 commits
d317405194
...
86543619e8
Author | SHA1 | Date | |
---|---|---|---|
86543619e8 | |||
e396ca0dc9 |
2 changed files with 9 additions and 9 deletions
|
@ -41,7 +41,7 @@
|
||||||
<button id="desc">Descrizione</button>
|
<button id="desc">Descrizione</button>
|
||||||
<button id="map">Mappa</button>
|
<button id="map">Mappa</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab" bind:this={ref}>
|
<div class="tab" bind:this={ref} role="tab">
|
||||||
<svelte:component this={component} route={route} />
|
<svelte:component this={component} route={route} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
let longitude;
|
let longitude;
|
||||||
let accuracy;
|
let accuracy;
|
||||||
const errorMessage = "Geolocation not available";
|
const errorMessage = "Geolocation not available";
|
||||||
|
const attribution = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||||
|
const openStreetMapTile = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||||
|
|
||||||
let errored = false;
|
let errored = false;
|
||||||
|
|
||||||
const watchPosition = async () => {
|
const watchPosition = async () => {
|
||||||
|
@ -59,15 +62,11 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
map.setView(pianelloCoordinates, 13);
|
map.setView(pianelloCoordinates, 13);
|
||||||
|
|
||||||
map.setMaxBounds(map.getBounds());
|
map.setMaxBounds(map.getBounds());
|
||||||
|
|
||||||
leaflet
|
leaflet
|
||||||
.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
.tileLayer(openStreetMapTile, {attribution})
|
||||||
attribution:
|
.addTo(map);
|
||||||
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
||||||
})
|
|
||||||
.addTo(map);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
@ -83,10 +82,11 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !errored}
|
{#if !errored}
|
||||||
<div id="map" in:fade bind:this={mapElement} />
|
<div id="map" in:fade bind:this={mapElement} />
|
||||||
{:else}
|
{:else}
|
||||||
{errorMessage}
|
{errorMessage}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Reference in a new issue