Compare commits

..

No commits in common. "4d53aabef417e9742d9f7b29b8271521ae61a4e5" and "99b1421ffcce791585ac3a2b1156fd1fcc01bd24" have entirely different histories.

2 changed files with 2 additions and 8 deletions

View file

@ -1,7 +1,6 @@
<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];
@ -18,7 +17,7 @@
const openStreetMapTile = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'; const openStreetMapTile = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
let errored = false; let errored = false;
const watchPosition = async () => { const watchPosition = async () => {
if (!("geolocation" in navigator)) { if (!("geolocation" in navigator)) {
errored = true; errored = true;
@ -40,12 +39,7 @@
longitude = crd.longitude; longitude = crd.longitude;
accuracy = crd.accuracy; accuracy = crd.accuracy;
const icon = leaflet.icon({ const userMarker = leaflet.marker([latitude, longitude]).addTo(map);
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());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB