2024-04-25 13:48:31 +02:00
|
|
|
<script lang="ts">
|
2025-10-19 14:15:52 +02:00
|
|
|
import { onDestroy, onMount } from 'svelte';
|
2025-10-23 19:07:32 +02:00
|
|
|
import { gpxLayers } from '$lib/components/map/gpx-layer/gpx-layers';
|
2025-10-19 14:15:52 +02:00
|
|
|
import { DistanceMarkers } from '$lib/components/map/gpx-layer/distance-markers';
|
|
|
|
|
import { StartEndMarkers } from '$lib/components/map/gpx-layer/start-end-markers';
|
2025-10-23 19:07:32 +02:00
|
|
|
import { createPopups, removePopups } from '$lib/components/map/gpx-layer/gpx-layer-popup';
|
|
|
|
|
import { map } from '$lib/components/map/map';
|
2024-05-23 11:21:57 +02:00
|
|
|
|
2025-10-19 14:15:52 +02:00
|
|
|
let distanceMarkers: DistanceMarkers;
|
|
|
|
|
let startEndMarkers: StartEndMarkers;
|
2024-04-25 13:48:31 +02:00
|
|
|
|
2025-10-17 23:54:45 +02:00
|
|
|
onMount(() => {
|
|
|
|
|
gpxLayers.init();
|
2025-10-19 14:15:52 +02:00
|
|
|
startEndMarkers = new StartEndMarkers();
|
|
|
|
|
distanceMarkers = new DistanceMarkers();
|
|
|
|
|
});
|
|
|
|
|
|
2025-10-23 19:07:32 +02:00
|
|
|
map.onLoad((map_) => {
|
|
|
|
|
createPopups(map_);
|
|
|
|
|
});
|
|
|
|
|
|
2025-10-19 14:15:52 +02:00
|
|
|
onDestroy(() => {
|
|
|
|
|
if (startEndMarkers) {
|
|
|
|
|
startEndMarkers.remove();
|
|
|
|
|
}
|
|
|
|
|
if (distanceMarkers) {
|
|
|
|
|
distanceMarkers.remove();
|
|
|
|
|
}
|
2025-10-23 19:07:32 +02:00
|
|
|
removePopups();
|
2025-02-02 11:17:22 +01:00
|
|
|
});
|
2024-04-25 13:48:31 +02:00
|
|
|
</script>
|