fix coordinates popup

This commit is contained in:
vcoppe
2025-10-23 19:07:32 +02:00
parent aa624e2c60
commit 1db9ecafef
4 changed files with 23 additions and 30 deletions

View File

@@ -1,20 +1,18 @@
<script lang="ts">
import { map } from '$lib/components/map/map.svelte';
import { trackpointPopup } from '$lib/components/map/gpx-layer/GPXLayerPopup';
import { map } from '$lib/components/map/map';
import { trackpointPopup } from '$lib/components/map/gpx-layer/gpx-layer-popup';
import { TrackPoint } from 'gpx';
$effect(() => {
if (map.current) {
map.current.on('contextmenu', (e) => {
trackpointPopup?.setItem({
item: new TrackPoint({
attributes: {
lat: e.lngLat.lat,
lon: e.lngLat.lng,
},
}),
});
map.onLoad((map_) => {
map_.on('contextmenu', (e) => {
trackpointPopup?.setItem({
item: new TrackPoint({
attributes: {
lat: e.lngLat.lat,
lon: e.lngLat.lng,
},
}),
});
}
});
});
</script>