From 4592b18db96fe6695ce02afeb24c56ecc0fe94b9 Mon Sep 17 00:00:00 2001 From: Jason <84899178+kommunarr@users.noreply.github.com> Date: Sat, 22 Jun 2024 21:18:37 +0000 Subject: [PATCH] Evaluate live chat scroll check on scrollend (#5302) --- .../watch-video-live-chat/watch-video-live-chat.js | 8 +++----- .../watch-video-live-chat/watch-video-live-chat.vue | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/renderer/components/watch-video-live-chat/watch-video-live-chat.js b/src/renderer/components/watch-video-live-chat/watch-video-live-chat.js index b1484c7573597..6a6daaefab93f 100644 --- a/src/renderer/components/watch-video-live-chat/watch-video-live-chat.js +++ b/src/renderer/components/watch-video-live-chat/watch-video-live-chat.js @@ -306,7 +306,7 @@ export default defineComponent({ } }, - onScroll: function (event) { + onScroll: function (event, isScrollEnd = false) { const liveChatComments = this.$refs.liveChatComments if (event.wheelDelta >= 0 && this.stayAtBottom) { this.stayAtBottom = false @@ -314,10 +314,8 @@ export default defineComponent({ if (liveChatComments.scrollHeight > liveChatComments.clientHeight) { this.showScrollToBottom = true } - } else if (event.wheelDelta < 0 && !this.stayAtBottom) { - if ((liveChatComments.scrollHeight - liveChatComments.scrollTop) === liveChatComments.clientHeight) { - this.scrollToBottom() - } + } else if ((isScrollEnd || event.wheelDelta < 0) && !this.stayAtBottom && (liveChatComments.scrollHeight - liveChatComments.scrollTop) === liveChatComments.clientHeight) { + this.scrollToBottom() } }, diff --git a/src/renderer/components/watch-video-live-chat/watch-video-live-chat.vue b/src/renderer/components/watch-video-live-chat/watch-video-live-chat.vue index f34c1991349f8..b3f591514ea76 100644 --- a/src/renderer/components/watch-video-live-chat/watch-video-live-chat.vue +++ b/src/renderer/components/watch-video-live-chat/watch-video-live-chat.vue @@ -128,6 +128,7 @@ class="liveChatComments" :style="{ blockSize: chatHeight }" @mousewheel="e => onScroll(e)" + @scrollend="e => onScroll(e, true)" >