Reader Changes (#600)

* After first page load, attempt to switch the fit based on Automatic scaling and image ratio compared to the screen size.

* Inform user that pressing save on mobile will reset margin and they don't have to press save.
This commit is contained in:
Joseph Milazzo 2021-09-27 06:06:35 -07:00 committed by GitHub
parent 6399e255e6
commit 403083d88a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 2 deletions

View file

@ -541,13 +541,16 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
}
resetSettings() {
resetSettings(afterSave: boolean = false) {
const windowWidth = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
let margin = '15%';
if (windowWidth <= 700) {
if (afterSave && this.user.preferences.bookReaderMargin !== 0) {
this.toastr.info('Margin will be reset to 0% on mobile. You do not have to save for settings to take effect.');
}
margin = '0%';
}
if (this.user) {
@ -913,7 +916,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
if (this.user) {
this.user.preferences = updatedPrefs;
}
this.resetSettings();
this.resetSettings(true);
});
}