add mute/unmute with the volume icon (#355)
This commit is contained in:
committed by
Feross Aboukhadijeh
parent
ae73ae29c4
commit
457aca25ee
@@ -321,7 +321,7 @@ function renderPlayerControls (state) {
|
|||||||
elements.push(hx`
|
elements.push(hx`
|
||||||
<div.volume
|
<div.volume
|
||||||
onwheel=${handleVolumeWheel}>
|
onwheel=${handleVolumeWheel}>
|
||||||
<i.icon.volume-icon>
|
<i.icon.volume-icon onmousedown=${handleVolumeMute}>
|
||||||
${volumeIcon}
|
${volumeIcon}
|
||||||
</i>
|
</i>
|
||||||
<input.volume-slider
|
<input.volume-slider
|
||||||
@@ -358,6 +358,15 @@ function renderPlayerControls (state) {
|
|||||||
dispatch('changeVolume', (-e.deltaY | e.deltaX) / 500)
|
dispatch('changeVolume', (-e.deltaY | e.deltaX) / 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handles volume muting and Unmuting
|
||||||
|
function handleVolumeMute (e) {
|
||||||
|
if (state.playing.volume === 0.0) {
|
||||||
|
dispatch('setVolume', 1.0)
|
||||||
|
} else {
|
||||||
|
dispatch('setVolume', 0.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Handles volume slider scrub
|
// Handles volume slider scrub
|
||||||
function handleVolumeScrub (e) {
|
function handleVolumeScrub (e) {
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user