Disable lyrics scrolling while the user is doing it themself (#1149)
* Disable lyrics scrolling while the user is doing it themself * Add scroll event to other .lyric-body element
This commit is contained in:
parent
40ba2f58da
commit
05b6ea112e
2 changed files with 10 additions and 3 deletions
|
@ -21,6 +21,7 @@ var app = new Vue({
|
|||
start: 0,
|
||||
end: 0
|
||||
},
|
||||
lyricsScrollingBlocked: false,
|
||||
queue: {},
|
||||
lowerPanelState: "controls",
|
||||
userInteraction: false
|
||||
|
@ -318,12 +319,18 @@ var app = new Vue({
|
|||
return {}
|
||||
}
|
||||
},
|
||||
blockLyricsScrolling() {
|
||||
this.lyricsScrollingBlocked = true;
|
||||
setTimeout(() => {
|
||||
this.lyricsScrollingBlocked = false;
|
||||
}, 100);
|
||||
},
|
||||
getLyricClass(start, end) {
|
||||
var currentTime = this.getCurrentTime();
|
||||
// check if currenttime is between start and end
|
||||
if (currentTime >= start && currentTime <= end) {
|
||||
setTimeout(() => {
|
||||
if (document.querySelector(".lyric-line.active")) {
|
||||
if (document.querySelector(".lyric-line.active") && !this.lyricsScrollingBlocked) {
|
||||
document.querySelector(".lyric-line.active").scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "center"
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-body lyric-body" style="width:100%;">
|
||||
<div class="md-body lyric-body" style="width:100%;" @scroll.passive="blockLyricsScrolling()">
|
||||
<template v-if="player.lyrics">
|
||||
<template v-for="lyric in player.lyrics" v-if="lyric.line != 'lrcInstrumental'">
|
||||
<h3 class="lyric-line" @click="seekTo(lyric.startTime, false)"
|
||||
|
@ -723,7 +723,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-body lyric-body">
|
||||
<div class="md-body lyric-body" @scroll.passive="blockLyricsScrolling()">
|
||||
<template v-if="player.lyrics">
|
||||
<template v-for="lyric in player.lyrics" v-if="lyric.line != 'lrcInstrumental'">
|
||||
<h3 class="lyric-line" @click="seekTo(lyric.startTime, false)"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue