mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-14 11:25:02 +02:00
Add:Change volume with hover and scroll wheel #366
This commit is contained in:
parent
0892291499
commit
6c6a0b4ba6
3 changed files with 19 additions and 17 deletions
|
@ -51,11 +51,25 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
scroll(e) {
|
||||
if (!e || !e.wheelDeltaY) return
|
||||
if (e.wheelDeltaY > 0) {
|
||||
this.volume = Math.min(1, this.volume + 0.1)
|
||||
} else {
|
||||
this.volume = Math.max(0, this.volume - 0.1)
|
||||
}
|
||||
},
|
||||
mouseover() {
|
||||
if (!this.isHovering) {
|
||||
window.addEventListener('mousewheel', this.scroll)
|
||||
}
|
||||
this.isHovering = true
|
||||
this.setOpen()
|
||||
},
|
||||
mouseleave() {
|
||||
if (this.isHovering) {
|
||||
window.removeEventListener('mousewheel', this.scroll)
|
||||
}
|
||||
this.isHovering = false
|
||||
},
|
||||
setOpen() {
|
||||
|
@ -127,6 +141,11 @@ export default {
|
|||
if (this.value === 0) {
|
||||
this.isMute = true
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.removeEventListener('mousewheel', this.scroll)
|
||||
document.body.removeEventListener('mousemove', this.mousemove)
|
||||
document.body.removeEventListener('mouseup', this.mouseup)
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue