mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-10-16 04:18:19 +00:00
waypoint popup info
This commit is contained in:
@@ -2,14 +2,9 @@
|
||||
import { map, selectedFiles, gpxLayers } from '$lib/stores';
|
||||
import { GPXLayer } from './GPXLayer';
|
||||
import { get } from 'svelte/store';
|
||||
import { onMount } from 'svelte';
|
||||
import mapboxgl from 'mapbox-gl';
|
||||
import WaypointPopup from './WaypointPopup.svelte';
|
||||
import { fileObservers } from '$lib/db';
|
||||
|
||||
let popupElement: HTMLElement;
|
||||
let popup: mapboxgl.Popup | null = null;
|
||||
|
||||
$: if ($map && $fileObservers) {
|
||||
gpxLayers.update(($layers) => {
|
||||
// remove layers for deleted files
|
||||
@@ -22,7 +17,7 @@
|
||||
// add layers for new files
|
||||
$fileObservers.forEach((file, fileId) => {
|
||||
if (!$layers.has(fileId)) {
|
||||
$layers.set(fileId, new GPXLayer(get(map), fileId, file, popup, popupElement));
|
||||
$layers.set(fileId, new GPXLayer(get(map), fileId, file));
|
||||
}
|
||||
});
|
||||
return $layers;
|
||||
@@ -34,15 +29,6 @@
|
||||
$gpxLayers.get(fileId)?.moveToFront();
|
||||
}
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
popup = new mapboxgl.Popup({
|
||||
closeButton: false,
|
||||
maxWidth: undefined
|
||||
});
|
||||
popup.setDOMContent(popupElement);
|
||||
popupElement.classList.remove('hidden');
|
||||
});
|
||||
</script>
|
||||
|
||||
<WaypointPopup bind:element={popupElement} />
|
||||
<WaypointPopup />
|
||||
|
Reference in New Issue
Block a user