From 567f81b2aa2b5347f91bdceb67d44a7ddc25978c Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Mon, 19 Apr 2021 16:59:25 +0200 Subject: [PATCH] Improving photo rendering during ligthbox navigation (preview mode) #207 --- .../app/ui/gallery/grid/grid.gallery.component.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/frontend/app/ui/gallery/grid/grid.gallery.component.ts b/src/frontend/app/ui/gallery/grid/grid.gallery.component.ts index b1c1b0e0..ea94fdfc 100644 --- a/src/frontend/app/ui/gallery/grid/grid.gallery.component.ts +++ b/src/frontend/app/ui/gallery/grid/grid.gallery.component.ts @@ -212,13 +212,22 @@ export class GalleryGridComponent implements OnChanges, OnInit, AfterViewInit, O } } + /** + * Makes sure that the photo with the given mediaString is visible on the screen + * @param mediaStringId + * @private + */ private renderUpToMedia(mediaStringId: string): void { const index = this.media.findIndex((p): boolean => this.queryService.getMediaStringId(p) === mediaStringId); if (index === -1) { this.router.navigate([], {queryParams: this.queryService.getParams()}); return; } - while (this.renderedPhotoIndex < index && this.renderARow()) { + // Make sure that at leas one more photo is rendered + // It is possible that only the last few pixels of a photo is visible, + // so not required to render more, but the scrollbar does not trigger more photos to render + // (on ligthbox navigation) + while (this.renderedPhotoIndex - 1 < (index + 1) && this.renderARow() !== null) { } } @@ -265,6 +274,8 @@ export class GalleryGridComponent implements OnChanges, OnInit, AfterViewInit, O } + // TODO: This is deprecated, + // we do not post update galleries anymore since the preview member in the DriectoryDTO private mergeNewPhotos(): void { // merge new data with old one let lastSameIndex = 0;