From 92fb185f2030331a5c26c7c70b06531b00157c21 Mon Sep 17 00:00:00 2001 From: Robbie Davis Date: Sun, 15 May 2022 17:21:17 -0400 Subject: [PATCH] Adding code to make sure bottom actionbar is applied on layout change (#1258) --- .../app/book-reader/book-reader/book-reader.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts b/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts index 15f45910f..abf5a49bb 100644 --- a/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts +++ b/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts @@ -818,7 +818,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy { setupPage(part?: string | undefined, scrollTop?: number | undefined) { this.isLoading = false; - this.scrollbarNeeded = this.readingHtml.nativeElement.clientHeight > this.reader.nativeElement.clientHeight; // Virtual Paging stuff this.updateWidthAndHeightCalcs(); @@ -1099,6 +1098,9 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy { updateWidthAndHeightCalcs() { this.windowHeight = Math.max(this.readingSectionElemRef.nativeElement.clientHeight, window.innerHeight); this.windowWidth = Math.max(this.readingSectionElemRef.nativeElement.clientWidth, window.innerWidth); + + // Recalculate if bottom action bar is needed + this.scrollbarNeeded = this.readingHtml.nativeElement.clientHeight > this.reader.nativeElement.clientHeight; } toggleDrawer() { @@ -1193,6 +1195,9 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy { // Remove any max-heights from column layout this.updateImagesWithHeight(); + + // Calulate if bottom actionbar is needed. On a timeout to get accurate heights + setTimeout(() => {this.scrollbarNeeded = this.readingHtml.nativeElement.clientHeight > this.reader.nativeElement.clientHeight;}); } updateReadingDirection(readingDirection: ReadingDirection) {