diff --git a/website/src/lib/components/map/gpx-layer/distance-markers.ts b/website/src/lib/components/map/gpx-layer/distance-markers.ts index 652ee0c4..17b80721 100644 --- a/website/src/lib/components/map/gpx-layer/distance-markers.ts +++ b/website/src/lib/components/map/gpx-layer/distance-markers.ts @@ -4,6 +4,7 @@ import { getConvertedDistanceToKilometers } from '$lib/units'; import type { GeoJSONSource } from 'mapbox-gl'; import { get } from 'svelte/store'; import { map } from '$lib/components/map/map'; +import { allHidden } from '$lib/logic/hidden'; const { distanceMarkers, distanceUnits } = settings; @@ -24,6 +25,7 @@ export class DistanceMarkers { this.unsubscribes.push(gpxStatistics.subscribe(this.updateBinded)); this.unsubscribes.push(distanceMarkers.subscribe(this.updateBinded)); this.unsubscribes.push(distanceUnits.subscribe(this.updateBinded)); + this.unsubscribes.push(allHidden.subscribe(this.updateBinded)); this.unsubscribes.push( map.subscribe((map_) => { if (map_) { @@ -38,7 +40,7 @@ export class DistanceMarkers { if (!map_) return; try { - if (get(distanceMarkers)) { + if (get(distanceMarkers) && !get(allHidden)) { let distanceSource: GeoJSONSource | undefined = map_.getSource('distance-markers'); if (distanceSource) { distanceSource.setData(this.getDistanceMarkersGeoJSON()); diff --git a/website/src/lib/components/map/gpx-layer/gpx-layer.ts b/website/src/lib/components/map/gpx-layer/gpx-layer.ts index 1b144879..ada89633 100644 --- a/website/src/lib/components/map/gpx-layer/gpx-layer.ts +++ b/website/src/lib/components/map/gpx-layer/gpx-layer.ts @@ -213,7 +213,7 @@ export class GPXLayer { 'text-halo-color': 'white', }, }, - _map.getLayer('distance-markers') ? 'distance-markers' : undefined + _map.getLayer('distance-markers-100') ? 'distance-markers-100' : undefined ); } } else { @@ -408,10 +408,7 @@ export class GPXLayer { _map.moveLayer(this.fileId); } if (_map.getLayer(this.fileId + '-direction')) { - _map.moveLayer( - this.fileId + '-direction', - _map.getLayer('distance-markers') ? 'distance-markers' : undefined - ); + _map.moveLayer(this.fileId + '-direction'); } } diff --git a/website/src/lib/components/map/gpx-layer/start-end-markers.ts b/website/src/lib/components/map/gpx-layer/start-end-markers.ts index ff211849..a2f77715 100644 --- a/website/src/lib/components/map/gpx-layer/start-end-markers.ts +++ b/website/src/lib/components/map/gpx-layer/start-end-markers.ts @@ -3,6 +3,7 @@ import { gpxStatistics, slicedGPXStatistics } from '$lib/logic/statistics'; import mapboxgl from 'mapbox-gl'; import { get } from 'svelte/store'; import { map } from '$lib/components/map/map'; +import { allHidden } from '$lib/logic/hidden'; export class StartEndMarkers { start: mapboxgl.Marker; @@ -24,6 +25,7 @@ export class StartEndMarkers { this.unsubscribes.push(gpxStatistics.subscribe(this.updateBinded)); this.unsubscribes.push(slicedGPXStatistics.subscribe(this.updateBinded)); this.unsubscribes.push(currentTool.subscribe(this.updateBinded)); + this.unsubscribes.push(allHidden.subscribe(this.updateBinded)); } update() { @@ -32,7 +34,8 @@ export class StartEndMarkers { const tool = get(currentTool); const statistics = get(slicedGPXStatistics)?.[0] ?? get(gpxStatistics); - if (statistics.local.points.length > 0 && tool !== Tool.ROUTING) { + const hidden = get(allHidden); + if (statistics.local.points.length > 0 && tool !== Tool.ROUTING && !hidden) { this.start.setLngLat(statistics.local.points[0].getCoordinates()).addTo(map_); this.end .setLngLat(