Compare commits

...

2 commits

Author SHA1 Message Date
4d53aabef4 Update user marker position
All checks were successful
ci/woodpecker/push/build Pipeline was successful
2023-12-13 19:02:00 +01:00
207af1abf1 Add user marker icon 2023-12-13 19:01:47 +01:00
2 changed files with 8 additions and 2 deletions

View file

@ -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];
@ -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());

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB