[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 Queue pgup/pgdown/home/end

Kasper (Sep 12, 2024, 2:08 AM +0200) 88f9f950 e8d42234

+14 -1
+2 -1
src/components/Queue.svelte
··· 21 21 import { assertUnreachable, checkShortcut } from '@/lib/helpers' 22 22 import type { TrackID } from 'ferrum-addon/addon' 23 23 import { fly } from 'svelte/transition' 24 - import VirtualListBlock from './VirtualListBlock.svelte' 24 + import VirtualListBlock, { scroll_container_keydown } from './VirtualListBlock.svelte' 25 25 26 26 let objectUrls: string[] = [] 27 27 ··· 186 186 bind:this={queue_element} 187 187 class="content relative -mt-px border-l outline-none" 188 188 tabindex="-1" 189 + on:keydown={scroll_container_keydown} 189 190 on:keydown={(e) => { 190 191 if (checkShortcut(e, 'Backspace') && $selection.count >= 1) { 191 192 e.preventDefault()
+12
src/components/VirtualListBlock.svelte
··· 1 + <script lang="ts" context="module"> 2 + export function scroll_container_keydown(e: KeyboardEvent & { currentTarget: HTMLElement }) { 3 + let prevent = true 4 + if (e.key === 'Home') e.currentTarget.scrollTop = 0 5 + else if (e.key === 'End') e.currentTarget.scrollTop = e.currentTarget.scrollHeight 6 + else if (e.key === 'PageUp') e.currentTarget.scrollTop -= e.currentTarget.clientHeight 7 + else if (e.key === 'PageDown') e.currentTarget.scrollTop += e.currentTarget.clientHeight 8 + else prevent = false 9 + if (prevent) e.preventDefault() 10 + } 11 + </script> 12 + 1 13 <script lang="ts" generics="T"> 2 14 import { onDestroy } from 'svelte' 3 15