[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix scroll to index when selection updates

Kasper (Jun 26, 2025, 12:45 AM +0200) 0e84c741 bb275f4d

+23 -6
+1
CHANGELOG.md
··· 1 1 # Changelog 2 2 3 3 ## Next 4 + - Fix scrolling not happening when using arrow keys 4 5 - Fix file errors not clickable 5 6 6 7 ## 0.19.7 - 2025 Jun 6
+1 -1
src/components/Queue.svelte
··· 200 200 > 201 201 {#if $queue.past.length || $queue.current} 202 202 <div class="relative"> 203 - <div class="sticky top-0 z-1 flex flex h-[40px] items-center bg-black/50 backdrop-blur-md"> 203 + <div class="sticky top-0 z-1 flex h-[40px] items-center bg-black/50 backdrop-blur-md"> 204 204 <button 205 205 type="button" 206 206 on:click={() => {
+4 -3
src/components/TrackList.svelte
··· 242 242 } 243 243 244 244 let viewport: HTMLElement 245 - onMount(() => { 246 - // tracklist_actions.scroll_to_index = virtual_list.scroll_to_index 247 - }) 248 245 249 246 type TrackListColumn = Column & { 250 247 name: string ··· 511 508 $: grid_columns = virtual_grid.set_columns(columns) 512 509 $: virtual_grid.set_source_items(tracks_page.itemIds) 513 510 $: $selection, $playing_id, virtual_grid.refresh(RefreshLevel.AllRows) 511 + 512 + onMount(() => { 513 + tracklist_actions.scroll_to_index = virtual_grid.scroll_to_index.bind(virtual_grid) 514 + }) 514 515 </script> 515 516 516 517 <Header
+2 -2
src/components/VirtualListBlock.svelte
··· 87 87 scroll_event_element?.removeEventListener('scroll', refresh) 88 88 }) 89 89 90 - export function scroll_to_index(index: number, offset = 0) { 90 + export function scroll_to_index(index: number, scroll_margin_bottom = 0) { 91 91 const dummy = document.createElement('div') 92 92 dummy.style.height = item_height + 'px' 93 93 dummy.style.position = 'absolute' 94 94 dummy.style.top = index * item_height + 'px' 95 95 // For some reason we apply the offset to the bottom 96 - dummy.style.scrollMarginBottom = offset + 'px' 96 + dummy.style.scrollMarginBottom = scroll_margin_bottom + 'px' 97 97 // eslint-disable-next-line svelte/no-dom-manipulating 98 98 main_element.prepend(dummy) 99 99 dummy.scrollIntoView({ behavior: 'instant', block: 'nearest' })
+15
src/lib/virtual-grid.ts
··· 248 248 } 249 249 } 250 250 251 + scroll_to_index(index: number, scroll_margin_bottom = 0) { 252 + if (!this.viewport) { 253 + throw new Error('No viewport') 254 + } 255 + const dummy = document.createElement('div') 256 + dummy.style.height = this.row_height + 'px' 257 + dummy.style.position = 'absolute' 258 + dummy.style.top = index * this.row_height + 'px' 259 + dummy.style.scrollMarginBottom = scroll_margin_bottom + 'px' 260 + this.viewport.prepend(dummy) 261 + dummy.scrollIntoView({ behavior: 'instant', block: 'nearest' }) 262 + dummy.remove() 263 + } 264 + 251 265 setup(node: HTMLElement) { 252 266 this.main_element = node 253 267 ··· 285 299 } 286 300 } 287 301 attach() { 302 + // This is a function in order to make `this` work 288 303 return (node: HTMLElement) => this.setup(node) 289 304 } 290 305 }