Compare commits
2 commits
99b1421ffc
...
4d53aabef4
Author | SHA1 | Date | |
---|---|---|---|
4d53aabef4 | |||
207af1abf1 |
2 changed files with 8 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
const mapMarkerIcon = new URL('/icons/map.png', import.meta.url).href
|
||||
|
||||
export let route;
|
||||
const pianelloCoordinates = [43.14, 12.53];
|
||||
|
@ -17,7 +18,7 @@
|
|||
const openStreetMapTile = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
|
||||
let errored = false;
|
||||
|
||||
|
||||
const watchPosition = async () => {
|
||||
if (!("geolocation" in navigator)) {
|
||||
errored = true;
|
||||
|
@ -39,7 +40,12 @@
|
|||
longitude = crd.longitude;
|
||||
accuracy = crd.accuracy;
|
||||
|
||||
const userMarker = leaflet.marker([latitude, longitude]).addTo(map);
|
||||
const icon = leaflet.icon({
|
||||
iconUrl: mapMarkerIcon,
|
||||
iconSize: [38, 95], // size of the icon
|
||||
});
|
||||
userMarker = leaflet.marker([latitude, longitude], {icon}).addTo(map);
|
||||
|
||||
// move the map to have the location in its center
|
||||
map.panTo(userMarker.getLatLng());
|
||||
|
||||
|
|
BIN
frontend/static/icons/map.png
Normal file
BIN
frontend/static/icons/map.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Loading…
Reference in a new issue