From 30e766be16dff121577ebb24d11881f73450c5cd Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Wed, 18 Mar 2020 14:48:10 +0800 Subject: [PATCH] feat(book reader): set reading direction from metadata --- komga-webui/src/views/BookReader.vue | 31 +++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/komga-webui/src/views/BookReader.vue b/komga-webui/src/views/BookReader.vue index 79b659667..2bdfc691d 100644 --- a/komga-webui/src/views/BookReader.vue +++ b/komga-webui/src/views/BookReader.vue @@ -240,6 +240,24 @@

Click or press next again
to exit the reader.

+ + +
This book has specific reading direction set.
+
Reading direction has been set to {{ readingDirs.find(x => x.value === readingDirection).text }}. +
+
This only applies to this book and will not overwrite your settings.
+ + Dismiss + +
@@ -279,6 +297,7 @@ export default Vue.extend({ jumpToNextBook: false, jumpToPreviousBook: false, jumpConfirmationDelay: 3000, + snackReadingDirection: false, pages: [] as PageDto[], supportedMediaTypes: ['image/jpeg', 'image/png', 'image/gif'], convertTo: 'jpeg', @@ -320,7 +339,6 @@ export default Vue.extend({ }, async mounted () { window.addEventListener('keydown', this.keyPressed) - this.setup(this.bookId, Number(this.$route.query.page)) this.loadFromCookie(cookieReadingDirection, (v) => { this.readingDirection = v @@ -341,6 +359,8 @@ export default Vue.extend({ this.backgroundColor = v } }) + + this.setup(this.bookId, Number(this.$route.query.page)) }, destroyed () { window.removeEventListener('keydown', this.keyPressed) @@ -518,6 +538,15 @@ export default Vue.extend({ this.goToFirst() } + switch (this.book.metadata.readingDirection) { + case ReadingDirection.LEFT_TO_RIGHT: + case ReadingDirection.RIGHT_TO_LEFT: + // bypass setter so cookies aren't set + this.settings.readingDirection = this.book.metadata.readingDirection + this.snackReadingDirection = true + break + } + try { this.siblingNext = await this.$komgaBooks.getBookSiblingNext(bookId) } catch (e) {