hack: prevent spacebar interactions in player UI

This commit is contained in:
ThaUnknown 2025-06-08 14:53:38 +02:00
parent d06c20ae52
commit 1eef1f25fe
No known key found for this signature in database
3 changed files with 7 additions and 4 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "ui", "name": "ui",
"version": "6.3.49", "version": "6.3.50",
"license": "BUSL-1.1", "license": "BUSL-1.1",
"private": true, "private": true,
"packageManager": "pnpm@9.14.4", "packageManager": "pnpm@9.14.4",

View file

@ -6,7 +6,7 @@
import { keys, layout, type KeyCode } from './maps.ts' import { keys, layout, type KeyCode } from './maps.ts'
type Bind <T extends Record<string, unknown> = Record<string, unknown>> = T & { type Bind <T extends Record<string, unknown> = Record<string, unknown>> = T & {
fn: () => void fn: (e: MouseEvent | KeyboardEvent) => void
id: string id: string
code?: KeyCode code?: KeyCode
} }
@ -27,7 +27,7 @@
async function runBind (e: MouseEvent | KeyboardEvent, code: KeyCode) { async function runBind (e: MouseEvent | KeyboardEvent, code: KeyCode) {
if ('repeat' in e && e.repeat) return if ('repeat' in e && e.repeat) return
const kbn = get(binds) const kbn = get(binds)
if (await cnd(code)) kbn[layout[code] ?? code]?.fn() if (await cnd(code)) kbn[layout[code] ?? code]?.fn(e)
} }
export function loadWithDefaults (defaults: Partial<Record<string, Bind>>) { export function loadWithDefaults (defaults: Partial<Record<string, Bind>>) {

View file

@ -492,7 +492,10 @@
desc: 'Toggle Stats' desc: 'Toggle Stats'
}, },
Space: { Space: {
fn: () => playPause(), fn: (e) => {
e.preventDefault()
playPause()
},
id: 'play_arrow', id: 'play_arrow',
icon: Play, icon: Play,
type: 'icon', type: 'icon',