This commit is contained in:
parent
6a28949f41
commit
e516f9fce5
1 changed files with 6 additions and 3 deletions
|
@ -2,11 +2,13 @@
|
|||
import { onMount, onDestroy } from 'svelte';
|
||||
import { fade, fly } from 'svelte/transition';
|
||||
|
||||
const parmaCoordinates = [44.8, 10.32];
|
||||
let mapElement: string | HTMLElement;
|
||||
let leaflet;
|
||||
let map;
|
||||
let layerGroup;
|
||||
let latitude;
|
||||
let longitude;
|
||||
let accuracy;
|
||||
|
||||
const loadWorker = async () => {
|
||||
if (!("geolocation" in navigator)) {
|
||||
|
@ -45,6 +47,7 @@
|
|||
|
||||
|
||||
onMount(async () => {
|
||||
await loadWorker();
|
||||
leaflet = await import('leaflet');
|
||||
layerGroup = leaflet.layerGroup();
|
||||
|
||||
|
@ -55,7 +58,7 @@
|
|||
minZoom: 12
|
||||
});
|
||||
|
||||
map.setView(parmaCoordinates, 13);
|
||||
map.setView([latitude, longitude], 13);
|
||||
map.setMaxBounds(map.getBounds());
|
||||
|
||||
leaflet
|
||||
|
@ -65,7 +68,7 @@
|
|||
})
|
||||
.addTo(map);
|
||||
|
||||
loadWorker();
|
||||
|
||||
});
|
||||
|
||||
onDestroy(async () => {
|
||||
|
|
Loading…
Reference in a new issue