intelliwaketssveltekitv25 1.0.16 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VirtualList.svelte +9 -5
- package/package.json +1 -1
package/dist/VirtualList.svelte
CHANGED
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
let bottom = $state(0)
|
|
32
32
|
let average_height: number | undefined = $state()
|
|
33
33
|
|
|
34
|
+
let is_scrolling = false
|
|
35
|
+
|
|
34
36
|
let visible = $derived(
|
|
35
37
|
items.slice(start, end).map((data, i) => ({
|
|
36
38
|
index: i + start,
|
|
@@ -79,7 +81,9 @@
|
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
async function handle_scroll() {
|
|
82
|
-
if (!viewport || !rows) return
|
|
84
|
+
if (!viewport || !rows || is_scrolling) return
|
|
85
|
+
|
|
86
|
+
is_scrolling = true
|
|
83
87
|
|
|
84
88
|
const { scrollTop } = viewport
|
|
85
89
|
|
|
@@ -135,12 +139,12 @@
|
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
const d = actual_height - expected_height
|
|
138
|
-
|
|
142
|
+
if (d !== 0) {
|
|
143
|
+
viewport.scrollTo(0, scrollTop + d)
|
|
144
|
+
}
|
|
139
145
|
}
|
|
140
146
|
|
|
141
|
-
|
|
142
|
-
// rows would occupy we may need to add some
|
|
143
|
-
// more. maybe we can just call handle_scroll again?
|
|
147
|
+
is_scrolling = false
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
// trigger initial refresh
|