From be3fc1c2459e5871032b86fc054301a19e65ae27 Mon Sep 17 00:00:00 2001 From: ZacKendallKing Date: Mon, 17 Jun 2024 16:57:19 +1000 Subject: [PATCH 1/6] Small webtoons - Disabled scrolling + Forced chapter buttons --- .../infinite-scroller.component.html | 72 +++++++++---------- .../infinite-scroller.component.ts | 13 +++- 2 files changed, 47 insertions(+), 38 deletions(-) diff --git a/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.html b/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.html index 1be1d0f7e5..c101c46e75 100644 --- a/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.html +++ b/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.html @@ -1,53 +1,51 @@ -
- Captures Scroll Events: {{!this.isScrolling && this.allImagesLoaded}} - Is Scrolling: {{isScrollingForwards() ? 'Forwards' : 'Backwards'}} {{this.isScrolling}} - All Images Loaded: {{this.allImagesLoaded}} - Prefetched {{minPageLoaded}}-{{maxPageLoaded}} - Pages: {{pageNum}} / {{totalPages - 1}} - At Top: {{atTop}} - At Bottom: {{atBottom}} - Total Height: {{getTotalHeight()}} - Total Scroll: {{getTotalScroll()}} - Scroll Top: {{getScrollTop()}} -
+
+ Captures Scroll Events: {{!this.isScrolling && this.allImagesLoaded}} + Is Scrolling: {{isScrollingForwards() ? 'Forwards' : 'Backwards'}} {{this.isScrolling}} + All Images Loaded: {{this.allImagesLoaded}} + Prefetched {{minPageLoaded}}-{{maxPageLoaded}} + Pages: {{pageNum}} / {{totalPages - 1}} + At Top: {{atTop}} + At Bottom: {{atBottom}} + Total Height: {{getTotalHeight()}} + Total Scroll: {{getTotalScroll()}} + Scroll Top: {{getScrollTop()}} +
- - -
- - image - -
+
+ + image + +
- -
- -
+ \ No newline at end of file diff --git a/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.ts b/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.ts index 0ae69300a8..025fd97713 100644 --- a/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.ts +++ b/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.ts @@ -284,6 +284,11 @@ export class InfiniteScrollerComponent implements OnInit, OnChanges, OnDestroy, this.cdRef.markForCheck(); } + //used to catch webtoons smaller than the viewport height + sizeLessthanView() { + return this.getTotalHeight() < this.getViewportHeight() + } + getVerticalOffset() { const reader = this.isFullscreenMode ? this.readerElemRef.nativeElement : this.document.body; @@ -354,6 +359,10 @@ export class InfiniteScrollerComponent implements OnInit, OnChanges, OnDestroy, return Math.round(totalHeight); } + getViewportHeight() { + return window.innerHeight + } + getTotalScroll() { if (this.isFullscreenMode) { return this.readerElemRef.nativeElement.offsetHeight + this.readerElemRef.nativeElement.scrollTop; @@ -563,7 +572,9 @@ export class InfiniteScrollerComponent implements OnInit, OnChanges, OnDestroy, } handleBottomIntersection(entries: IntersectionObserverEntry[]) { - if (entries.length > 0 && this.pageNum > this.totalPages - 5 && this.initFinished) { + // On small webtoons, the trigger will be caught on comic load, leading to all chapters being progressively skipped. + // Thus !this.sizeLessthanView() disables the autoscroll functionality on webtoons smaller than viewport height. + if (!this.sizeLessthanView() && entries.length > 0 && this.pageNum > this.totalPages - 5 && this.initFinished) { this.debugLog('[Intersection] The whole bottom spacer is visible', entries[0].isIntersecting); this.loadNextChapter.emit(); } From c6070a3b1e4b3c10ff5ec951058c4b49c274fd74 Mon Sep 17 00:00:00 2001 From: ZacKendallKing Date: Tue, 18 Jun 2024 16:22:50 +1000 Subject: [PATCH 2/6] Scroll enabled on small webtoons. --- .../infinite-scroller.component.html | 4 +-- .../infinite-scroller.component.scss | 24 +++++++-------- .../infinite-scroller.component.ts | 30 ++++++++++++++++--- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.html b/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.html index c101c46e75..246b330dd1 100644 --- a/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.html +++ b/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.html @@ -13,7 +13,7 @@ Scroll Top: {{getScrollTop()}} -