Add static initial pianello coordinates
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
80c53c6de6
commit
ed0d21020e
1 changed files with 4 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
import { onMount, onDestroy } from 'svelte';
|
import { onMount, onDestroy } from 'svelte';
|
||||||
import { fade, fly } from 'svelte/transition';
|
import { fade, fly } from 'svelte/transition';
|
||||||
|
|
||||||
|
const pianelloCoordinates = [43.14, 12.53];
|
||||||
let mapElement: string | HTMLElement;
|
let mapElement: string | HTMLElement;
|
||||||
let leaflet;
|
let leaflet;
|
||||||
let map;
|
let map;
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
let latitude;
|
let latitude;
|
||||||
let longitude;
|
let longitude;
|
||||||
let accuracy;
|
let accuracy;
|
||||||
|
|
||||||
const loadWorker = async () => {
|
const loadWorker = async () => {
|
||||||
if (!("geolocation" in navigator)) {
|
if (!("geolocation" in navigator)) {
|
||||||
return;
|
return;
|
||||||
|
@ -35,7 +36,6 @@
|
||||||
string += `Longitude: ${crd.longitude}`;
|
string += `Longitude: ${crd.longitude}`;
|
||||||
string += `More or less ${crd.accuracy} meters.`;
|
string += `More or less ${crd.accuracy} meters.`;
|
||||||
|
|
||||||
map.setView([latitude, longitude], 13);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function error(err) {
|
function error(err) {
|
||||||
|
@ -46,6 +46,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
await loadWorker();
|
||||||
leaflet = await import('leaflet');
|
leaflet = await import('leaflet');
|
||||||
layerGroup = leaflet.layerGroup();
|
layerGroup = leaflet.layerGroup();
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@
|
||||||
minZoom: 12
|
minZoom: 12
|
||||||
});
|
});
|
||||||
|
|
||||||
await loadWorker();
|
map.setView(pianelloCoordinates, 13);
|
||||||
|
|
||||||
map.setMaxBounds(map.getBounds());
|
map.setMaxBounds(map.getBounds());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue