2024-04-25 13:48:31 +02:00
|
|
|
<script lang="ts">
|
2025-10-17 23:54:45 +02:00
|
|
|
import { gpxLayers } from '$lib/components/map/gpx-layer/gpx-layers';
|
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
|
// import { map, gpxLayers } from '$lib/stores';
|
|
|
|
|
// import { GPXLayer } from './gpx-layer';
|
|
|
|
|
// import { DistanceMarkers } from './DistanceMarkers';
|
|
|
|
|
// import { StartEndMarkers } from './StartEndMarkers';
|
|
|
|
|
// import { onDestroy } from 'svelte';
|
|
|
|
|
// import { createPopups, removePopups } from './GPXLayerPopup';
|
2024-05-23 11:21:57 +02:00
|
|
|
|
2025-10-17 23:54:45 +02:00
|
|
|
// let distanceMarkers = $derived(map.current ? new DistanceMarkers(map.current) : undefined);
|
|
|
|
|
// let startEndMarkers = $derived(map.current ? new StartEndMarkers(map.current) : undefined);
|
2024-04-25 13:48:31 +02:00
|
|
|
|
2025-10-17 23:54:45 +02:00
|
|
|
// $: if ($map) {
|
|
|
|
|
// if (distanceMarkers) {
|
|
|
|
|
// distanceMarkers.remove();
|
|
|
|
|
// }
|
|
|
|
|
// if (startEndMarkers) {
|
|
|
|
|
// startEndMarkers.remove();
|
|
|
|
|
// }
|
|
|
|
|
// createPopups($map);
|
|
|
|
|
// distanceMarkers = new DistanceMarkers($map);
|
|
|
|
|
// startEndMarkers = new StartEndMarkers($map);
|
|
|
|
|
// }
|
2024-04-25 13:48:31 +02:00
|
|
|
|
2025-10-17 23:54:45 +02:00
|
|
|
// onDestroy(() => {
|
|
|
|
|
// removePopups();
|
|
|
|
|
// if (distanceMarkers) {
|
|
|
|
|
// distanceMarkers.remove();
|
|
|
|
|
// distanceMarkers = undefined;
|
|
|
|
|
// }
|
|
|
|
|
// if (startEndMarkers) {
|
|
|
|
|
// startEndMarkers.remove();
|
|
|
|
|
// startEndMarkers = undefined;
|
|
|
|
|
// }
|
|
|
|
|
// });
|
2024-07-13 11:42:21 +02:00
|
|
|
|
2025-10-17 23:54:45 +02:00
|
|
|
onMount(() => {
|
|
|
|
|
gpxLayers.init();
|
2025-02-02 11:17:22 +01:00
|
|
|
});
|
2024-04-25 13:48:31 +02:00
|
|
|
</script>
|