新增鼠标在音量按钮使用滚轮时可以调整音量大小的功能(#2000)

This commit is contained in:
lyswhut
2024-08-10 10:18:27 +08:00
parent 6ff7cfde11
commit 85c9ec38db
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -1,6 +1,6 @@
<template>
<material-popup-btn :class="$style.btnContent">
<button :class="$style.btn" :aria-label="isMute ? $t('player__volume_muted') : `${$t('player__volume')}${parseInt(volume * 100)}%`">
<button :class="$style.btn" :aria-label="isMute ? $t('player__volume_muted') : `${$t('player__volume')}${parseInt(volume * 100)}%`" @wheel="handleWheel">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" width="100%" viewBox="0 0 24 24" space="preserve">
<use :xlink:href="icon" />
</svg>
@@ -30,6 +30,10 @@ import { computed } from '@common/utils/vueTools'
import { saveVolumeIsMute } from '@renderer/store/setting'
import { volume, isMute } from '@renderer/store/player/volume'
const handleWheel = (event) => {
window.app_event.setVolume(Math.round(volume.value * 100 + (-event.deltaY / 100 * 2)) / 100)
}
const handleUpdateVolume = (val) => {
window.app_event.setVolume(val)
}