Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

On desktop devices, when reading with fit to width or original, next page would't reset scroll position. (#535)

Joseph Milazzo61220a02a1dc
diff --git a/API.Benchmark/Program.cs b/API.Benchmark/Program.cs
index 8111eaecc..05c296f8b 100644
--- a/API.Benchmark/Program.cs
+++ b/API.Benchmark/Program.cs
@@ -8,7 +8,7 @@ namespace API.Benchmark
/// then copy the outputted dll
/// dotnet copied_string\API.Benchmark.dll
/// </summary>
- public class Program
+ public static class Program
{
static void Main(string[] args)
{
diff --git a/UI/Web/src/app/manga-reader/manga-reader.component.ts b/UI/Web/src/app/manga-reader/manga-reader.component.ts
index 4dc6fe371..8e6d8c9b3 100644
--- a/UI/Web/src/app/manga-reader/manga-reader.component.ts
+++ b/UI/Web/src/app/manga-reader/manga-reader.component.ts
@@ -482,11 +482,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
getFittingIcon() {
- let value = FITTING_OPTION.HEIGHT;
- const formControl = this.generalSettingsForm.get('fittingOption');
- if (formControl !== undefined) {
- value = formControl?.value;
- }
+ const value = this.getFit();
switch(value) {
case FITTING_OPTION.HEIGHT:
@@ -498,6 +494,15 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
}
+ getFit() {
+ let value = FITTING_OPTION.HEIGHT;
+ const formControl = this.generalSettingsForm.get('fittingOption');
+ if (formControl !== undefined) {
+ value = formControl?.value;
+ }
+ return value;
+ }
+
cancelMenuCloseTimer() {
if (this.menuTimeout) {
clearTimeout(this.menuTimeout);
@@ -735,6 +740,11 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
} else {
this.ctx.drawImage(this.canvasImage, 0, 0);
}
+ // Reset scroll on non HEIGHT Fits
+ if (this.getFit() !== FITTING_OPTION.HEIGHT) {
+ window.scrollTo(0, 0);
+ }
+
}
this.isLoading = false;
}