There is a bug with the book reader where 1 col lays out as 2 on some pages, I can't solve.
This commit is contained in:
parent
05fccc2115
commit
359c637605
2 changed files with 29 additions and 36 deletions
|
|
@ -21,7 +21,6 @@ import {ToastrService} from 'ngx-toastr';
|
||||||
import {forkJoin, fromEvent, merge, of} from 'rxjs';
|
import {forkJoin, fromEvent, merge, of} from 'rxjs';
|
||||||
import {catchError, debounceTime, distinctUntilChanged, take, tap} from 'rxjs/operators';
|
import {catchError, debounceTime, distinctUntilChanged, take, tap} from 'rxjs/operators';
|
||||||
import {Chapter} from 'src/app/_models/chapter';
|
import {Chapter} from 'src/app/_models/chapter';
|
||||||
import {AccountService} from 'src/app/_services/account.service';
|
|
||||||
import {NavService} from 'src/app/_services/nav.service';
|
import {NavService} from 'src/app/_services/nav.service';
|
||||||
import {CHAPTER_ID_DOESNT_EXIST, CHAPTER_ID_NOT_FETCHED, ReaderService} from 'src/app/_services/reader.service';
|
import {CHAPTER_ID_DOESNT_EXIST, CHAPTER_ID_NOT_FETCHED, ReaderService} from 'src/app/_services/reader.service';
|
||||||
import {SeriesService} from 'src/app/_services/series.service';
|
import {SeriesService} from 'src/app/_services/series.service';
|
||||||
|
|
@ -40,7 +39,6 @@ import {LibraryType} from 'src/app/_models/library/library';
|
||||||
import {BookTheme} from 'src/app/_models/preferences/book-theme';
|
import {BookTheme} from 'src/app/_models/preferences/book-theme';
|
||||||
import {BookPageLayoutMode} from 'src/app/_models/readers/book-page-layout-mode';
|
import {BookPageLayoutMode} from 'src/app/_models/readers/book-page-layout-mode';
|
||||||
import {PageStyle, ReaderSettingsComponent} from '../reader-settings/reader-settings.component';
|
import {PageStyle, ReaderSettingsComponent} from '../reader-settings/reader-settings.component';
|
||||||
import {User} from 'src/app/_models/user';
|
|
||||||
import {ThemeService} from 'src/app/_services/theme.service';
|
import {ThemeService} from 'src/app/_services/theme.service';
|
||||||
import {ScrollService} from 'src/app/_services/scroll.service';
|
import {ScrollService} from 'src/app/_services/scroll.service';
|
||||||
import {PAGING_DIRECTION} from 'src/app/manga-reader/_models/reader-enums';
|
import {PAGING_DIRECTION} from 'src/app/manga-reader/_models/reader-enums';
|
||||||
|
|
@ -122,7 +120,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
|
|
||||||
private readonly route = inject(ActivatedRoute);
|
private readonly route = inject(ActivatedRoute);
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
private readonly accountService = inject(AccountService);
|
|
||||||
private readonly seriesService = inject(SeriesService);
|
private readonly seriesService = inject(SeriesService);
|
||||||
private readonly readerService = inject(ReaderService);
|
private readonly readerService = inject(ReaderService);
|
||||||
private readonly renderer = inject(Renderer2);
|
private readonly renderer = inject(Renderer2);
|
||||||
|
|
@ -149,7 +146,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
volumeId!: number;
|
volumeId!: number;
|
||||||
chapterId!: number;
|
chapterId!: number;
|
||||||
chapter!: Chapter;
|
chapter!: Chapter;
|
||||||
user!: User;
|
|
||||||
readingProfile!: ReadingProfile;
|
readingProfile!: ReadingProfile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -640,16 +636,8 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.accountService.currentUser$.pipe(take(1)).subscribe(user => {
|
|
||||||
if (user) {
|
|
||||||
this.user = user;
|
|
||||||
this.init();
|
this.init();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
@ -787,6 +775,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
this.readerService.closeReader(this.readingListMode, this.readingListId);
|
this.readerService.closeReader(this.readingListMode, this.readingListId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sortElements(a: Element, b: Element) {
|
sortElements(a: Element, b: Element) {
|
||||||
const aTop = a.getBoundingClientRect().top;
|
const aTop = a.getBoundingClientRect().top;
|
||||||
const bTop = b.getBoundingClientRect().top;
|
const bTop = b.getBoundingClientRect().top;
|
||||||
|
|
@ -1065,7 +1054,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
|
|
||||||
// Virtual Paging stuff
|
// Virtual Paging stuff
|
||||||
this.updateWidthAndHeightCalcs();
|
this.updateWidthAndHeightCalcs();
|
||||||
this.updateLayoutMode(this.layoutMode || BookPageLayoutMode.Default);
|
this.updateLayoutMode(this.layoutMode);
|
||||||
this.addEmptyPageIfRequired();
|
this.addEmptyPageIfRequired();
|
||||||
|
|
||||||
// Find all the part ids and their top offset
|
// Find all the part ids and their top offset
|
||||||
|
|
|
||||||
|
|
@ -202,32 +202,15 @@ export class ReaderSettingsComponent implements OnInit {
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.parentReadingProfile = this.readingProfile;
|
this.parentReadingProfile = this.readingProfile;
|
||||||
|
this.cdRef.markForCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fontFamilies = this.bookService.getFontFamilies();
|
this.fontFamilies = this.bookService.getFontFamilies();
|
||||||
this.fontOptions = this.fontFamilies.map(f => f.title);
|
this.fontOptions = this.fontFamilies.map(f => f.title);
|
||||||
this.cdRef.markForCheck();
|
|
||||||
|
|
||||||
if (this.readingProfile.bookReaderFontFamily === undefined) {
|
|
||||||
this.readingProfile.bookReaderFontFamily = 'default';
|
|
||||||
}
|
this.cdRef.markForCheck();
|
||||||
if (this.readingProfile.bookReaderFontSize === undefined || this.readingProfile.bookReaderFontSize < 50) {
|
|
||||||
this.readingProfile.bookReaderFontSize = 100;
|
|
||||||
}
|
|
||||||
if (this.readingProfile.bookReaderLineSpacing === undefined || this.readingProfile.bookReaderLineSpacing < 100) {
|
|
||||||
this.readingProfile.bookReaderLineSpacing = 100;
|
|
||||||
}
|
|
||||||
if (this.readingProfile.bookReaderMargin === undefined) {
|
|
||||||
this.readingProfile.bookReaderMargin = 0;
|
|
||||||
}
|
|
||||||
if (this.readingProfile.bookReaderReadingDirection === undefined) {
|
|
||||||
this.readingProfile.bookReaderReadingDirection = ReadingDirection.LeftToRight;
|
|
||||||
}
|
|
||||||
if (this.readingProfile.bookReaderWritingStyle === undefined) {
|
|
||||||
this.readingProfile.bookReaderWritingStyle = WritingStyle.Horizontal;
|
|
||||||
}
|
|
||||||
this.readingDirectionModel = this.readingProfile.bookReaderReadingDirection;
|
|
||||||
this.writingStyleModel = this.readingProfile.bookReaderWritingStyle;
|
|
||||||
|
|
||||||
this.setupSettings();
|
this.setupSettings();
|
||||||
|
|
||||||
|
|
@ -254,6 +237,27 @@ export class ReaderSettingsComponent implements OnInit {
|
||||||
setupSettings() {
|
setupSettings() {
|
||||||
if (!this.readingProfile) return;
|
if (!this.readingProfile) return;
|
||||||
|
|
||||||
|
if (this.readingProfile.bookReaderFontFamily === undefined) {
|
||||||
|
this.readingProfile.bookReaderFontFamily = 'default';
|
||||||
|
}
|
||||||
|
if (this.readingProfile.bookReaderFontSize === undefined || this.readingProfile.bookReaderFontSize < 50) {
|
||||||
|
this.readingProfile.bookReaderFontSize = 100;
|
||||||
|
}
|
||||||
|
if (this.readingProfile.bookReaderLineSpacing === undefined || this.readingProfile.bookReaderLineSpacing < 100) {
|
||||||
|
this.readingProfile.bookReaderLineSpacing = 100;
|
||||||
|
}
|
||||||
|
if (this.readingProfile.bookReaderMargin === undefined) {
|
||||||
|
this.readingProfile.bookReaderMargin = 0;
|
||||||
|
}
|
||||||
|
if (this.readingProfile.bookReaderReadingDirection === undefined) {
|
||||||
|
this.readingProfile.bookReaderReadingDirection = ReadingDirection.LeftToRight;
|
||||||
|
}
|
||||||
|
if (this.readingProfile.bookReaderWritingStyle === undefined) {
|
||||||
|
this.readingProfile.bookReaderWritingStyle = WritingStyle.Horizontal;
|
||||||
|
}
|
||||||
|
this.readingDirectionModel = this.readingProfile.bookReaderReadingDirection;
|
||||||
|
this.writingStyleModel = this.readingProfile.bookReaderWritingStyle;
|
||||||
|
|
||||||
this.settingsForm.addControl('bookReaderFontFamily', new FormControl(this.readingProfile.bookReaderFontFamily, []));
|
this.settingsForm.addControl('bookReaderFontFamily', new FormControl(this.readingProfile.bookReaderFontFamily, []));
|
||||||
this.settingsForm.get('bookReaderFontFamily')!.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(fontName => {
|
this.settingsForm.get('bookReaderFontFamily')!.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(fontName => {
|
||||||
const familyName = this.fontFamilies.filter(f => f.title === fontName)[0].family;
|
const familyName = this.fontFamilies.filter(f => f.title === fontName)[0].family;
|
||||||
|
|
@ -290,7 +294,7 @@ export class ReaderSettingsComponent implements OnInit {
|
||||||
this.styleUpdate.emit(this.pageStyles);
|
this.styleUpdate.emit(this.pageStyles);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.settingsForm.addControl('layoutMode', new FormControl(this.readingProfile.bookReaderLayoutMode || BookPageLayoutMode.Default, []));
|
this.settingsForm.addControl('layoutMode', new FormControl(this.readingProfile.bookReaderLayoutMode, []));
|
||||||
this.settingsForm.get('layoutMode')?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((layoutMode: BookPageLayoutMode) => {
|
this.settingsForm.get('layoutMode')?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((layoutMode: BookPageLayoutMode) => {
|
||||||
this.layoutModeUpdate.emit(layoutMode);
|
this.layoutModeUpdate.emit(layoutMode);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue