From c0cf85e9a8cb2c992c9a9737b0cf07eeb1771f06 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 19 Oct 2022 15:54:20 -0700 Subject: [PATCH] refactor: get rid of timeline scroll funcs --- src/components/Timeline.vue | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index 56093210..53506ce9 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -403,18 +403,6 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { } } - /** Store the current scroll position to restore later */ - private getScrollY() { - const recycler = this.$refs.recycler as any; - return recycler.$el.scrollTop - } - - /** Restore the stored scroll position */ - private setScrollY(y: number) { - const recycler = this.$refs.recycler as any; - recycler.scrollToPosition(y); - } - /** Get query string for API calls */ appendQuery(url: string) { const query = new URLSearchParams(); @@ -793,9 +781,6 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { const headIdx = this.list.findIndex(item => item.id === head.id); let rowIdx = headIdx + 1; - // Store the scroll position in case we change any rows - const scrollY = this.getScrollY(); - // Previous justified row let prevJustifyTop = justify[0]?.top || 0; @@ -922,7 +907,7 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) { const recycler: any = this.$refs.recycler; const midIndex = (recycler.$_startIndex + recycler.$_endIndex) / 2; if (midIndex > headIdx) { - this.setScrollY(scrollY + rowSizeDelta); + recycler.$el.scrollTop += rowSizeDelta; } } }