1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-11-24 08:42:24 +02:00

showing gpx tracks in folders without a photo with gps position. #422

This commit is contained in:
Patrik J. Braun 2022-02-27 19:07:00 +01:00
parent 6be727397c
commit 211a5bd4dd
4 changed files with 20 additions and 16 deletions

View File

@ -59,7 +59,7 @@
class="oi oi-chevron-{{blogOpen ? 'top' : 'bottom'}}"></span>
</button>
</div>
<app-gallery-map *ngIf="isPhotoWithLocation && mapEnabled"
<app-gallery-map *ngIf="(isPhotoWithLocation || (directoryContent?.metaFile | gpxFiles)?.length > 0) && mapEnabled"
[photos]="directoryContent?.media | photosOnly"
[gpxFiles]="directoryContent?.metaFile | gpxFiles"></app-gallery-map>
</div>

View File

@ -354,6 +354,9 @@ export class GalleryMapLightboxComponent implements OnChanges {
}
private centerMap(): void {
if (this.mapLayersControlOption.overlays.Photos.getLayers().length === 0) {
return;
}
this.leafletMap.fitBounds(
latLngBounds((this.mapLayersControlOption.overlays.Photos.getLayers() as Marker[])
.map(m => m.getLatLng())

View File

@ -1,13 +1,11 @@
<ng-template [ngIf]="markerLayer.length>0">
<app-gallery-map-lightbox [photos]="photos" [gpxFiles]="gpxFiles"></app-gallery-map-lightbox>
<div class="clickable" id="map" #map (click)="click()">
<div
class="leaflet-map"
leaflet
[leafletOptions]="options"
[leafletLayers]="markerLayer"
(leafletMapReady)="onMapReady($event)">
</div>
<app-gallery-map-lightbox [photos]="photos" [gpxFiles]="gpxFiles"></app-gallery-map-lightbox>
<div class="clickable" id="map" #map (click)="click()">
<div
class="leaflet-map"
leaflet
[leafletOptions]="options"
[leafletLayers]="markerLayer"
(leafletMapReady)="onMapReady($event)">
</div>
</ng-template>
</div>

View File

@ -30,6 +30,7 @@ export class GalleryMapComponent implements OnChanges, IRenderable {
doubleClickZoom: false,
boxZoom: false,
zoom: 0,
center: [0, 0]
};
markerLayer: Marker[] = [];
@ -42,9 +43,11 @@ export class GalleryMapComponent implements OnChanges, IRenderable {
onMapReady(map: Map): void {
this.leafletMap = map;
this.leafletMap.setView(this.markerLayer[0].getLatLng(), 99);
this.leafletMap.fitBounds(this.markerLayer.map((mp): [number, number] =>
[mp.getLatLng().lat, mp.getLatLng().lng] as [number, number]));
if (this.markerLayer.length > 0) {
this.leafletMap.setView(this.markerLayer[0].getLatLng(), 99);
this.leafletMap.fitBounds(this.markerLayer.map((mp): [number, number] =>
[mp.getLatLng().lat, mp.getLatLng().lng] as [number, number]));
}
this.leafletMap.setZoom(0);
}