mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Add custom volume step (#2594)
This commit is contained in:
parent
24b8282c2f
commit
fd5d07160a
@ -82,7 +82,8 @@ export const builtInActions: Record<string, KeyBindingAction> = {
|
|||||||
volumeUp: {
|
volumeUp: {
|
||||||
displayName: '增加音量',
|
displayName: '增加音量',
|
||||||
run: () => {
|
run: () => {
|
||||||
const volume = playerAgent.changeVolume(10)
|
const step = getComponentSettings<Options>('keymap').options.volumeStep
|
||||||
|
const volume = playerAgent.changeVolume(step)
|
||||||
if (lodash.isNil(volume)) {
|
if (lodash.isNil(volume)) {
|
||||||
return volume
|
return volume
|
||||||
}
|
}
|
||||||
@ -93,7 +94,8 @@ export const builtInActions: Record<string, KeyBindingAction> = {
|
|||||||
volumeDown: {
|
volumeDown: {
|
||||||
displayName: '降低音量',
|
displayName: '降低音量',
|
||||||
run: () => {
|
run: () => {
|
||||||
const volume = playerAgent.changeVolume(-10)
|
const step = getComponentSettings<Options>('keymap').options.volumeStep
|
||||||
|
const volume = playerAgent.changeVolume(-step)
|
||||||
if (lodash.isNil(volume)) {
|
if (lodash.isNil(volume)) {
|
||||||
return volume
|
return volume
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,11 +9,18 @@ import { addComponentListener } from '@/core/settings'
|
|||||||
import { actions } from './actions'
|
import { actions } from './actions'
|
||||||
import { KeyBinding, KeyBindingConfig, loadKeyBindings } from './bindings'
|
import { KeyBinding, KeyBindingConfig, loadKeyBindings } from './bindings'
|
||||||
import { presetBase, presets } from './presets'
|
import { presetBase, presets } from './presets'
|
||||||
|
import { getNumberValidator } from '@/core/utils'
|
||||||
|
|
||||||
const options = defineOptionsMetadata({
|
const options = defineOptionsMetadata({
|
||||||
longJumpSeconds: {
|
longJumpSeconds: {
|
||||||
defaultValue: 85,
|
defaultValue: 85,
|
||||||
displayName: '长跳跃秒数',
|
displayName: '长跳跃秒数',
|
||||||
|
validator: getNumberValidator(1),
|
||||||
|
},
|
||||||
|
volumeStep: {
|
||||||
|
defaultValue: 10,
|
||||||
|
displayName: '音量调整幅度',
|
||||||
|
validator: getNumberValidator(1, 100),
|
||||||
},
|
},
|
||||||
customKeyBindings: {
|
customKeyBindings: {
|
||||||
defaultValue: {} as Record<string, string>,
|
defaultValue: {} as Record<string, string>,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user