Compare commits
No commits in common. "c9faabc9454ac618b8f28bbf03332f0611d37f78" and "76d9f46fa518152cc5547000d567616d881087d4" have entirely different histories.
c9faabc945
...
76d9f46fa5
3 changed files with 2 additions and 21 deletions
6
frontend/package-lock.json
generated
6
frontend/package-lock.json
generated
|
@ -9,7 +9,6 @@
|
||||||
"version": "0.6.0",
|
"version": "0.6.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"leaflet-gpx": "^1.7.0",
|
|
||||||
"svelte-preprocess": "^5.1.3"
|
"svelte-preprocess": "^5.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -2368,11 +2367,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
|
||||||
"integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA=="
|
"integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA=="
|
||||||
},
|
},
|
||||||
"node_modules/leaflet-gpx": {
|
|
||||||
"version": "1.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/leaflet-gpx/-/leaflet-gpx-1.7.0.tgz",
|
|
||||||
"integrity": "sha512-5NS5WKfp5zaAHMB2KM6OUaIng+SZ3e/UHK2++ABl2wELojYlmLqIL8t1Mj6DaZGkIh3kld+mAUvMGdIzC1yGRA=="
|
|
||||||
},
|
|
||||||
"node_modules/levn": {
|
"node_modules/levn": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"leaflet-gpx": "^1.7.0",
|
|
||||||
"svelte-preprocess": "^5.1.3"
|
"svelte-preprocess": "^5.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
const pianelloCoordinates = [43.14, 12.53];
|
const pianelloCoordinates = [43.14, 12.53];
|
||||||
let mapElement: string | HTMLElement;
|
let mapElement: string | HTMLElement;
|
||||||
let leaflet;
|
let leaflet;
|
||||||
let leafletGPX;
|
|
||||||
let map;
|
let map;
|
||||||
let layerGroup;
|
let layerGroup;
|
||||||
let latitude;
|
let latitude;
|
||||||
|
@ -67,10 +66,9 @@
|
||||||
layerGroup = leaflet.layerGroup();
|
layerGroup = leaflet.layerGroup();
|
||||||
|
|
||||||
// Startup Map
|
// Startup Map
|
||||||
|
|
||||||
map = leaflet.map(mapElement, {
|
map = leaflet.map(mapElement, {
|
||||||
//dragging: leaflet.Browser.mobile,
|
dragging: leaflet.Browser.mobile,
|
||||||
//tap: leaflet.Browser.mobile,
|
tap: leaflet.Browser.mobile,
|
||||||
});
|
});
|
||||||
|
|
||||||
map.setView(pianelloCoordinates, 13);
|
map.setView(pianelloCoordinates, 13);
|
||||||
|
@ -80,21 +78,11 @@
|
||||||
.addTo(map);
|
.addTo(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderGPX = () => {
|
|
||||||
const gpx = "/gpx/tidone.gpx"; // URL to your GPX file or the GPX itself
|
|
||||||
new leafletGPX(gpx, {async: true}).on('loaded', function(e) {
|
|
||||||
map.fitBounds(e.target.getBounds());
|
|
||||||
}).addTo(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await watchPosition();
|
await watchPosition();
|
||||||
leaflet = await import('leaflet');
|
leaflet = await import('leaflet');
|
||||||
const {GPX} = await import('leaflet-gpx');
|
|
||||||
leafletGPX = GPX;
|
|
||||||
|
|
||||||
renderMap();
|
renderMap();
|
||||||
renderGPX();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onDestroy(async () => {
|
onDestroy(async () => {
|
||||||
|
|
Loading…
Reference in a new issue