Skip to content

Commit 6996065

Browse files
committed
fix(timeline): list autoscroll
1 parent 018e616 commit 6996065

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/app-frontend/src/features/timeline/TimelineEventList.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import Defer from '@front/mixins/defer'
44
import { computed, ref, watch } from '@vue/composition-api'
55
import TimelineEventListItem from './TimelineEventListItem.vue'
66
7+
const itemHeight = 34
8+
79
export default {
810
components: { TimelineEventListItem },
911
mixins: [
@@ -77,7 +79,7 @@ export default {
7779
7880
const index = filteredEvents.value.indexOf(inspectedEvent.value)
7981
if (index !== -1) {
80-
scrollerEl.scrollTop = 39 * (index + 0.5) - (scrollerEl.clientHeight) / 2
82+
scrollerEl.scrollTop = itemHeight * (index + 0.5) - (scrollerEl.clientHeight) / 2
8183
}
8284
}
8385
@@ -91,8 +93,8 @@ export default {
9193
const scrollerEl = scroller.value.$el
9294
9395
const index = filteredEvents.value.indexOf(inspectedEvent.value)
94-
const minPosition = 39 * index
95-
const maxPosition = minPosition + 39
96+
const minPosition = itemHeight * index
97+
const maxPosition = minPosition + itemHeight
9698
9799
if (scrollerEl.scrollTop > minPosition || scrollerEl.scrollTop + scrollerEl.clientHeight < maxPosition) {
98100
scrollToInspectedEvent()
@@ -127,6 +129,7 @@ export default {
127129
scroller,
128130
filter,
129131
filteredEvents,
132+
itemHeight,
130133
inspectedEvent,
131134
inspectEvent,
132135
selectEvent
@@ -172,8 +175,8 @@ export default {
172175
<RecycleScroller
173176
ref="scroller"
174177
:items="filteredEvents"
175-
:item-size="34"
176-
class="flex-1"
178+
:item-size="itemHeight"
179+
class="flex-1 scroll-smooth"
177180
>
178181
<template #default="{ item: event }">
179182
<TimelineEventListItem

0 commit comments

Comments
 (0)