diff --git a/registry/lib/components/utils/keymap/actions.ts b/registry/lib/components/utils/keymap/actions.ts index 40ff3ff3e..6ac9c2d7f 100644 --- a/registry/lib/components/utils/keymap/actions.ts +++ b/registry/lib/components/utils/keymap/actions.ts @@ -82,7 +82,8 @@ export const builtInActions: Record = { volumeUp: { displayName: '增加音量', run: () => { - const volume = playerAgent.changeVolume(10) + const step = getComponentSettings('keymap').options.volumeStep + const volume = playerAgent.changeVolume(step) if (lodash.isNil(volume)) { return volume } @@ -93,7 +94,8 @@ export const builtInActions: Record = { volumeDown: { displayName: '降低音量', run: () => { - const volume = playerAgent.changeVolume(-10) + const step = getComponentSettings('keymap').options.volumeStep + const volume = playerAgent.changeVolume(-step) if (lodash.isNil(volume)) { return volume } diff --git a/registry/lib/components/utils/keymap/index.ts b/registry/lib/components/utils/keymap/index.ts index 5f57b9896..aa0977529 100644 --- a/registry/lib/components/utils/keymap/index.ts +++ b/registry/lib/components/utils/keymap/index.ts @@ -9,11 +9,18 @@ import { addComponentListener } from '@/core/settings' import { actions } from './actions' import { KeyBinding, KeyBindingConfig, loadKeyBindings } from './bindings' import { presetBase, presets } from './presets' +import { getNumberValidator } from '@/core/utils' const options = defineOptionsMetadata({ longJumpSeconds: { defaultValue: 85, displayName: '长跳跃秒数', + validator: getNumberValidator(1), + }, + volumeStep: { + defaultValue: 10, + displayName: '音量调整幅度', + validator: getNumberValidator(1, 100), }, customKeyBindings: { defaultValue: {} as Record,