fix(volume-slider): fix scrolling
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2346>
This commit is contained in:
parent
d6ea66e519
commit
c362a7fd90
|
@ -25,6 +25,10 @@ const handleLeave = () => {
|
||||||
stop()
|
stop()
|
||||||
start()
|
start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scroll = (event: WheelEvent) => {
|
||||||
|
volume.value += -Math.sign(event.deltaY) * 0.05
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -34,6 +38,7 @@ const handleLeave = () => {
|
||||||
@click.prevent.stop=""
|
@click.prevent.stop=""
|
||||||
@mouseover="handleOver"
|
@mouseover="handleOver"
|
||||||
@mouseleave="handleLeave"
|
@mouseleave="handleLeave"
|
||||||
|
@wheel.stop.prevent="scroll"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
v-if="volume === 0"
|
v-if="volume === 0"
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { useQueue, currentIndex, currentTrack } from './queue'
|
||||||
import { useStore } from '~/store'
|
import { useStore } from '~/store'
|
||||||
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { useClamp } from '@vueuse/math'
|
||||||
|
|
||||||
// Looping
|
// Looping
|
||||||
export enum LoopingMode {
|
export enum LoopingMode {
|
||||||
|
@ -57,7 +58,7 @@ export const usePlayer = createGlobalState(() => {
|
||||||
// Volume
|
// Volume
|
||||||
const lastVolume = useStorage('player:last-volume', 0.7)
|
const lastVolume = useStorage('player:last-volume', 0.7)
|
||||||
|
|
||||||
const volume: Ref<number> = useStorage('player:volume', 0.7)
|
const volume: Ref<number> = useClamp(useStorage('player:volume', 0.7), 0, 1)
|
||||||
watch(volume, (gain) => setGain(gain), { immediate: true })
|
watch(volume, (gain) => setGain(gain), { immediate: true })
|
||||||
|
|
||||||
const mute = () => {
|
const mute = () => {
|
||||||
|
|
Loading…
Reference in New Issue