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

This commit is contained in:
Joseph Milazzo 2021-08-29 07:23:52 -07:00 committed by GitHub
parent 8b82829161
commit 61220a02a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -8,7 +8,7 @@ namespace API.Benchmark
/// then copy the outputted dll /// then copy the outputted dll
/// dotnet copied_string\API.Benchmark.dll /// dotnet copied_string\API.Benchmark.dll
/// </summary> /// </summary>
public class Program public static class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {

View File

@ -482,11 +482,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
} }
getFittingIcon() { getFittingIcon() {
let value = FITTING_OPTION.HEIGHT; const value = this.getFit();
const formControl = this.generalSettingsForm.get('fittingOption');
if (formControl !== undefined) {
value = formControl?.value;
}
switch(value) { switch(value) {
case FITTING_OPTION.HEIGHT: 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() { cancelMenuCloseTimer() {
if (this.menuTimeout) { if (this.menuTimeout) {
clearTimeout(this.menuTimeout); clearTimeout(this.menuTimeout);
@ -735,6 +740,11 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
} else { } else {
this.ctx.drawImage(this.canvasImage, 0, 0); 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; this.isLoading = false;
} }