Update user marker position
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
207af1abf1
commit
4d53aabef4
1 changed files with 8 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy } from 'svelte';
|
import { onMount, onDestroy } from 'svelte';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
|
const mapMarkerIcon = new URL('/icons/map.png', import.meta.url).href
|
||||||
|
|
||||||
export let route;
|
export let route;
|
||||||
const pianelloCoordinates = [43.14, 12.53];
|
const pianelloCoordinates = [43.14, 12.53];
|
||||||
|
@ -39,7 +40,12 @@
|
||||||
longitude = crd.longitude;
|
longitude = crd.longitude;
|
||||||
accuracy = crd.accuracy;
|
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
|
// move the map to have the location in its center
|
||||||
map.panTo(userMarker.getLatLng());
|
map.panTo(userMarker.getLatLng());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue