From b8cbe14ae67193385558af91ba2c76496fac739a Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 22 Oct 2022 10:15:28 -0700 Subject: [PATCH] Fix hover cursor stutter on day load --- src/components/ScrollerManager.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/ScrollerManager.vue b/src/components/ScrollerManager.vue index 47bf6416..3ce6ee4f 100644 --- a/src/components/ScrollerManager.vue +++ b/src/components/ScrollerManager.vue @@ -108,13 +108,21 @@ export default class ScrollerManager extends Mixins(GlobalMixin) { // Get the scroll position const scroll = this.recycler?.$el?.scrollTop || 0; - // Move hover cursor to px position + // Get cursor px position const {top1, top2, y1, y2} = this.getCoords(scroll, 'y'); const topfrac = (scroll - y1) / (y2 - y1); const rtop = top1 + (top2 - top1) * topfrac; + // Always move static cursor to right position this.cursorY = utils.roundHalf(rtop); - this.moveHoverCursor(this.cursorY); + + // Move hover cursor to same position unless hovering + // Regardless, we need this call because the internal mapping might have changed + if ((this.$refs.scroller).matches(':hover')) { + this.moveHoverCursor(this.hoverCursorY); + } else { + this.moveHoverCursor(this.cursorY); + } // Show the scroller for some time if (this.scrollingRecyclerTimer) window.clearTimeout(this.scrollingRecyclerTimer);