mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-11-04 13:31:13 +00:00
fix coordinates popup
This commit is contained in:
@@ -1,11 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { map } from '$lib/components/map/map.svelte';
|
import { map } from '$lib/components/map/map';
|
||||||
import { trackpointPopup } from '$lib/components/map/gpx-layer/GPXLayerPopup';
|
import { trackpointPopup } from '$lib/components/map/gpx-layer/gpx-layer-popup';
|
||||||
import { TrackPoint } from 'gpx';
|
import { TrackPoint } from 'gpx';
|
||||||
|
|
||||||
$effect(() => {
|
map.onLoad((map_) => {
|
||||||
if (map.current) {
|
map_.on('contextmenu', (e) => {
|
||||||
map.current.on('contextmenu', (e) => {
|
|
||||||
trackpointPopup?.setItem({
|
trackpointPopup?.setItem({
|
||||||
item: new TrackPoint({
|
item: new TrackPoint({
|
||||||
attributes: {
|
attributes: {
|
||||||
@@ -15,6 +14,5 @@
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,33 +1,31 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { gpxLayers } from '$lib/components/map/gpx-layer/gpx-layers';
|
|
||||||
import { onDestroy, onMount } from 'svelte';
|
import { onDestroy, onMount } from 'svelte';
|
||||||
// import { map, gpxLayers } from '$lib/stores';
|
import { gpxLayers } from '$lib/components/map/gpx-layer/gpx-layers';
|
||||||
// import { GPXLayer } from './gpx-layer';
|
|
||||||
import { DistanceMarkers } from '$lib/components/map/gpx-layer/distance-markers';
|
import { DistanceMarkers } from '$lib/components/map/gpx-layer/distance-markers';
|
||||||
import { StartEndMarkers } from '$lib/components/map/gpx-layer/start-end-markers';
|
import { StartEndMarkers } from '$lib/components/map/gpx-layer/start-end-markers';
|
||||||
// import { onDestroy } from 'svelte';
|
import { createPopups, removePopups } from '$lib/components/map/gpx-layer/gpx-layer-popup';
|
||||||
// import { createPopups, removePopups } from './GPXLayerPopup';
|
import { map } from '$lib/components/map/map';
|
||||||
|
|
||||||
let distanceMarkers: DistanceMarkers;
|
let distanceMarkers: DistanceMarkers;
|
||||||
let startEndMarkers: StartEndMarkers;
|
let startEndMarkers: StartEndMarkers;
|
||||||
|
|
||||||
// $: if ($map) {
|
|
||||||
// createPopups($map);
|
|
||||||
// }
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
gpxLayers.init();
|
gpxLayers.init();
|
||||||
startEndMarkers = new StartEndMarkers();
|
startEndMarkers = new StartEndMarkers();
|
||||||
distanceMarkers = new DistanceMarkers();
|
distanceMarkers = new DistanceMarkers();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
map.onLoad((map_) => {
|
||||||
|
createPopups(map_);
|
||||||
|
});
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
// removePopups();
|
|
||||||
if (startEndMarkers) {
|
if (startEndMarkers) {
|
||||||
startEndMarkers.remove();
|
startEndMarkers.remove();
|
||||||
}
|
}
|
||||||
if (distanceMarkers) {
|
if (distanceMarkers) {
|
||||||
distanceMarkers.remove();
|
distanceMarkers.remove();
|
||||||
}
|
}
|
||||||
|
removePopups();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -5,15 +5,12 @@
|
|||||||
import WithUnits from '$lib/components/WithUnits.svelte';
|
import WithUnits from '$lib/components/WithUnits.svelte';
|
||||||
import { Compass, Mountain, Timer } from '@lucide/svelte';
|
import { Compass, Mountain, Timer } from '@lucide/svelte';
|
||||||
import { i18n } from '$lib/i18n.svelte';
|
import { i18n } from '$lib/i18n.svelte';
|
||||||
import type { PopupItem } from '$lib/components/map/map';
|
import type { PopupItem } from '$lib/components/map/map-popup';
|
||||||
|
|
||||||
let { trackpoint }: { trackpoint: PopupItem<TrackPoint> } = $props();
|
let { trackpoint }: { trackpoint: PopupItem<TrackPoint> } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Card.Root class="border-none shadow-md text-base p-2">
|
<Card.Root class="border-none shadow-md text-base p-2">
|
||||||
<Card.Header class="p-0">
|
|
||||||
<Card.Title class="text-md"></Card.Title>
|
|
||||||
</Card.Header>
|
|
||||||
<Card.Content class="flex flex-col p-0 text-xs gap-1">
|
<Card.Content class="flex flex-col p-0 text-xs gap-1">
|
||||||
<div class="flex flex-row items-center gap-1">
|
<div class="flex flex-row items-center gap-1">
|
||||||
<Compass size="14" />
|
<Compass size="14" />
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
import Toolbar from '$lib/components/toolbar/Toolbar.svelte';
|
import Toolbar from '$lib/components/toolbar/Toolbar.svelte';
|
||||||
import StreetViewControl from '$lib/components/map/street-view-control/StreetViewControl.svelte';
|
import StreetViewControl from '$lib/components/map/street-view-control/StreetViewControl.svelte';
|
||||||
import LayerControl from '$lib/components/map/layer-control/LayerControl.svelte';
|
import LayerControl from '$lib/components/map/layer-control/LayerControl.svelte';
|
||||||
// import CoordinatesPopup from '$lib/components/map/CoordinatesPopup.svelte';
|
import CoordinatesPopup from '$lib/components/map/CoordinatesPopup.svelte';
|
||||||
import Resizer from '$lib/components/Resizer.svelte';
|
import Resizer from '$lib/components/Resizer.svelte';
|
||||||
import { Toaster } from '$lib/components/ui/sonner';
|
import { Toaster } from '$lib/components/ui/sonner';
|
||||||
import { languages } from '$lib/languages';
|
import { languages } from '$lib/languages';
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
<StreetViewControl />
|
<StreetViewControl />
|
||||||
<LayerControl />
|
<LayerControl />
|
||||||
<GPXLayers />
|
<GPXLayers />
|
||||||
<!-- <CoordinatesPopup /> -->
|
<CoordinatesPopup />
|
||||||
<Toaster richColors />
|
<Toaster richColors />
|
||||||
{#if !$treeFileView}
|
{#if !$treeFileView}
|
||||||
<div class="h-10 -translate-y-10 w-full pointer-events-none absolute z-30">
|
<div class="h-10 -translate-y-10 w-full pointer-events-none absolute z-30">
|
||||||
|
|||||||
Reference in New Issue
Block a user