mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-03-13 16:22:59 +00:00
32 lines
987 B
Svelte
32 lines
987 B
Svelte
<script lang="ts">
|
|
import { onDestroy, onMount } from 'svelte';
|
|
import { gpxLayers } from '$lib/components/map/gpx-layer/gpx-layers';
|
|
import { DistanceMarkers } from '$lib/components/map/gpx-layer/distance-markers';
|
|
import { StartEndMarkers } from '$lib/components/map/gpx-layer/start-end-markers';
|
|
import { createPopups, removePopups } from '$lib/components/map/gpx-layer/gpx-layer-popup';
|
|
import { map } from '$lib/components/map/map';
|
|
|
|
let distanceMarkers: DistanceMarkers;
|
|
let startEndMarkers: StartEndMarkers;
|
|
|
|
onMount(() => {
|
|
gpxLayers.init();
|
|
startEndMarkers = new StartEndMarkers();
|
|
distanceMarkers = new DistanceMarkers();
|
|
});
|
|
|
|
map.onLoad((map_) => {
|
|
createPopups(map_);
|
|
});
|
|
|
|
onDestroy(() => {
|
|
if (startEndMarkers) {
|
|
startEndMarkers.remove();
|
|
}
|
|
if (distanceMarkers) {
|
|
distanceMarkers.remove();
|
|
}
|
|
removePopups();
|
|
});
|
|
</script>
|