File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import { onMount , tick } from ' svelte'
3
+ import VirtualList from ' ./VirtualList.svelte'
3
4
4
5
export let items: any []
5
6
export let height = ' 100%'
6
7
7
8
export let scrollPos: number = 0
9
+ let initialScrollPos = scrollPos
8
10
9
11
// Number of additional elements out of view. Helps when scrolling fast.
10
12
export let pad = 1
100
102
onMount (() => {
101
103
mounted = true
102
104
onScroll ()
105
+
106
+ if (initialScrollPos !== 0 ) {
107
+ setTimeout (() => (viewport .scrollTop = initialScrollPos ))
108
+ }
103
109
})
104
110
</script >
105
111
Original file line number Diff line number Diff line change 13
13
visibleOnly ,
14
14
scrollPos ,
15
15
} from ' ../../stores/mountainFilters'
16
- import { getOlContext } from ' ../../ol/Map.svelte'
17
- import onMountTick from ' ../../utils/onMountTick'
18
16
import { fromLonLat } from ' ol/proj'
19
17
import { extent } from ' ../../stores/map'
20
18
import { containsCoordinate } from ' ol/extent'
21
- import { onMount } from ' svelte'
22
- import BettererList from ' ../BettererList.svelte'
23
19
import BetterList from ' ../BetterList.svelte'
24
20
25
21
let hasGrade: number
96
92
(showing {filteredMountains .length } of {totalMountains } mountains)
97
93
</div >
98
94
<div class =" flex flex-col gap-2 -mx-4 -mb-4 min-h-0 flex-1" >
99
- <BetterList items ={sorted } let:item >
95
+ <BetterList items ={sorted } let:item bind:scrollPos ={ $scrollPos } >
100
96
<div
101
97
class =" cursor-pointer px-4 py-1"
102
98
on:keyup ={(e ) => {
You can’t perform that action at this time.
0 commit comments