mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 23:53:25 +00:00
hide file
This commit is contained in:
@@ -50,6 +50,7 @@ export class GPXLayer {
|
||||
fileId: string;
|
||||
file: Readable<GPXFileWithStatistics | undefined>;
|
||||
layerColor: string;
|
||||
hidden: boolean = false;
|
||||
markers: mapboxgl.Marker[] = [];
|
||||
selected: boolean = false;
|
||||
draggable: boolean;
|
||||
@@ -362,6 +363,17 @@ export class GPXLayer {
|
||||
}
|
||||
}
|
||||
|
||||
toggleVisibility() {
|
||||
this.hidden = !this.hidden;
|
||||
if (this.hidden) {
|
||||
this.map.setLayoutProperty(this.fileId, 'visibility', 'none');
|
||||
this.markers.forEach(marker => marker.remove());
|
||||
} else {
|
||||
this.map.setLayoutProperty(this.fileId, 'visibility', 'visible');
|
||||
this.markers.forEach(marker => marker.addTo(this.map));
|
||||
}
|
||||
}
|
||||
|
||||
getGeoJSON(): GeoJSON.FeatureCollection {
|
||||
let file = get(this.file)?.file;
|
||||
if (!file) {
|
||||
|
Reference in New Issue
Block a user