Set static coordinates
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Alessio Davoli 2023-07-18 17:50:42 +02:00
parent 6a28949f41
commit e516f9fce5

View file

@ -2,11 +2,13 @@
import { onMount, onDestroy } from 'svelte'; import { onMount, onDestroy } from 'svelte';
import { fade, fly } from 'svelte/transition'; import { fade, fly } from 'svelte/transition';
const parmaCoordinates = [44.8, 10.32];
let mapElement: string | HTMLElement; let mapElement: string | HTMLElement;
let leaflet; let leaflet;
let map; let map;
let layerGroup; let layerGroup;
let latitude;
let longitude;
let accuracy;
const loadWorker = async () => { const loadWorker = async () => {
if (!("geolocation" in navigator)) { if (!("geolocation" in navigator)) {
@ -45,6 +47,7 @@
onMount(async () => { onMount(async () => {
await loadWorker();
leaflet = await import('leaflet'); leaflet = await import('leaflet');
layerGroup = leaflet.layerGroup(); layerGroup = leaflet.layerGroup();
@ -55,7 +58,7 @@
minZoom: 12 minZoom: 12
}); });
map.setView(parmaCoordinates, 13); map.setView([latitude, longitude], 13);
map.setMaxBounds(map.getBounds()); map.setMaxBounds(map.getBounds());
leaflet leaflet
@ -65,7 +68,7 @@
}) })
.addTo(map); .addTo(map);
loadWorker();
}); });
onDestroy(async () => { onDestroy(async () => {