From 8928959fdb8adf9c555379c67a13a657fc291e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20B=C3=B6hm?= Date: Fri, 28 Aug 2020 14:09:57 +0200 Subject: [PATCH] fix(webui): compute scrollability on mount, fix right chevron when using display scaling --- komga-webui/src/components/HorizontalScroller.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/komga-webui/src/components/HorizontalScroller.vue b/komga-webui/src/components/HorizontalScroller.vue index dfa038fa0..24b089bda 100644 --- a/komga-webui/src/components/HorizontalScroller.vue +++ b/komga-webui/src/components/HorizontalScroller.vue @@ -44,19 +44,20 @@ export default Vue.extend({ }, mounted () { this.container = this.$refs[this.id] as HTMLElement + this.computeScrollability() }, methods: { computeScrollability () { if (this.container !== undefined) { - this.canScrollLeft = this.container.scrollLeft > 0 - this.canScrollRight = (this.container.scrollLeft + this.container.clientWidth) < this.container.scrollWidth + this.canScrollLeft = Math.round(this.container.scrollLeft) > 0 + this.canScrollRight = (Math.round(this.container.scrollLeft) + this.container.clientWidth) < this.container.scrollWidth } }, doScroll (direction: string) { if (this.container !== undefined) { - let target = this.container.scrollLeft + (this.container.clientWidth - this.adjustment) + let target = Math.round(this.container.scrollLeft) + (this.container.clientWidth - this.adjustment) if (direction === 'left') { - target = this.container.scrollLeft - (this.container.clientWidth - this.adjustment) + target = Math.round(this.container.scrollLeft) - (this.container.clientWidth - this.adjustment) } const scrollMax = this.container.clientWidth this.container.scrollTo({