mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-01-10 04:07:35 +02:00
Clearing map on close #647
This commit is contained in:
parent
61970c2025
commit
68d09cec46
@ -452,7 +452,7 @@ export class GalleryLightboxComponent implements OnDestroy, OnInit {
|
||||
}
|
||||
|
||||
private updateActivePhoto(photoIndex: number, resize = true): void {
|
||||
if (photoIndex < 0 || photoIndex > this.gridPhotoQL.length) {
|
||||
if (photoIndex < 0 || photoIndex >= this.gridPhotoQL.length) {
|
||||
throw new Error('Can\'t find the media');
|
||||
}
|
||||
this.videoSourceError = false;
|
||||
|
@ -240,7 +240,7 @@ export class GalleryMapLightboxComponent implements OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
public async show(position: Dimension): Promise<void> {
|
||||
this.hideImages();
|
||||
this.clearMap();
|
||||
this.visible = true;
|
||||
this.opacity = 1.0;
|
||||
this.startPosition = position;
|
||||
@ -288,13 +288,13 @@ export class GalleryMapLightboxComponent implements OnChanges, OnDestroy {
|
||||
this.opacity = 0.0;
|
||||
setTimeout((): void => {
|
||||
this.visible = false;
|
||||
this.hideImages();
|
||||
this.clearMap();
|
||||
this.leafletMap.setZoom(2);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
showImages(): void {
|
||||
this.hideImages();
|
||||
this.clearImages();
|
||||
|
||||
// make sure to enable photos layers when opening map
|
||||
if (
|
||||
@ -410,7 +410,12 @@ export class GalleryMapLightboxComponent implements OnChanges, OnDestroy {
|
||||
mp.preview.thumbnail.CurrentlyWaiting = true;
|
||||
}
|
||||
|
||||
hideImages(): void {
|
||||
clearMap() {
|
||||
this.clearImages();
|
||||
this.clearPath();
|
||||
}
|
||||
|
||||
clearImages(): void {
|
||||
this.thumbnailsOnLoad.forEach((th): void => {
|
||||
th.destroy();
|
||||
});
|
||||
@ -419,6 +424,11 @@ export class GalleryMapLightboxComponent implements OnChanges, OnDestroy {
|
||||
this.mapLayersControlOption.overlays.Photos.clearLayers();
|
||||
}
|
||||
|
||||
clearPath(): void {
|
||||
this.pathLayersConfigOrdered.forEach(p => p.layer.clearLayers());
|
||||
|
||||
}
|
||||
|
||||
@HostListener('window:keydown', ['$event'])
|
||||
onKeyPress(event: KeyboardEvent): void {
|
||||
if (this.visible !== true) {
|
||||
@ -486,7 +496,7 @@ export class GalleryMapLightboxComponent implements OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
private async loadGPXFiles(): Promise<void> {
|
||||
this.pathLayersConfigOrdered.forEach(p => p.layer.clearLayers());
|
||||
this.clearPath();
|
||||
if (this.gpxFiles.length === 0) {
|
||||
|
||||
this.pathLayersConfigOrdered.forEach(p => {
|
||||
|
Loading…
Reference in New Issue
Block a user