From 41059330982cec39acb5b5840f97a90329e33562 Mon Sep 17 00:00:00 2001 From: Sergey Elpashev Date: Wed, 17 Jul 2024 23:46:33 +0300 Subject: [PATCH] feat: manhwa scroll and cache pages rework --- .../components/reader/lazyscroll.directive.ts | 19 -- .../components/reader/reader.component.html | 12 +- .../app/components/reader/reader.component.ts | 224 ++++++------------ .../src/app/components/reader/reader.dto.ts | 2 +- .../scale-image/scale-image.component.html | 6 +- .../scale-image/scale-image.component.ts | 26 +- 6 files changed, 106 insertions(+), 183 deletions(-) delete mode 100644 apps/NwaifuAnime/src/app/components/reader/lazyscroll.directive.ts diff --git a/apps/NwaifuAnime/src/app/components/reader/lazyscroll.directive.ts b/apps/NwaifuAnime/src/app/components/reader/lazyscroll.directive.ts deleted file mode 100644 index 09fb31c..0000000 --- a/apps/NwaifuAnime/src/app/components/reader/lazyscroll.directive.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Directive, ElementRef } from "@angular/core"; - -@Directive({ - selector: "[appLazyLoad]", - standalone: true, -}) -export class LazyLoadDirective { - constructor({ nativeElement }: ElementRef) { - const observer = new IntersectionObserver( - (entries) => { - console.log(entries); - }, - { - rootMargin: "1000px", - }, - ); - observer.observe(nativeElement); - } -} diff --git a/apps/NwaifuAnime/src/app/components/reader/reader.component.html b/apps/NwaifuAnime/src/app/components/reader/reader.component.html index 6ba6203..81dd75b 100644 --- a/apps/NwaifuAnime/src/app/components/reader/reader.component.html +++ b/apps/NwaifuAnime/src/app/components/reader/reader.component.html @@ -11,17 +11,21 @@

{{ currentChapterInfo?.number }}. {{ currentChapterInfo?.name || "Нет названия" }}

- @if (pages.length > 0 && cachedPages.get(currentPageIndex)) { + @if (pages.length > 0 && currentPage) {
@if (!isManhwa) { - + } @else { @for (page of manhwaPages; track page.id) { - + } }
-