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,
|
start: 0,
|
||||||
end: 0
|
end: 0
|
||||||
},
|
},
|
||||||
|
lyricsScrollingBlocked: false,
|
||||||
queue: {},
|
queue: {},
|
||||||
lowerPanelState: "controls",
|
lowerPanelState: "controls",
|
||||||
userInteraction: false
|
userInteraction: false
|
||||||
|
@ -318,12 +319,18 @@ var app = new Vue({
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
blockLyricsScrolling() {
|
||||||
|
this.lyricsScrollingBlocked = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
this.lyricsScrollingBlocked = false;
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
getLyricClass(start, end) {
|
getLyricClass(start, end) {
|
||||||
var currentTime = this.getCurrentTime();
|
var currentTime = this.getCurrentTime();
|
||||||
// check if currenttime is between start and end
|
// check if currenttime is between start and end
|
||||||
if (currentTime >= start && currentTime <= end) {
|
if (currentTime >= start && currentTime <= end) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (document.querySelector(".lyric-line.active")) {
|
if (document.querySelector(".lyric-line.active") && !this.lyricsScrollingBlocked) {
|
||||||
document.querySelector(".lyric-line.active").scrollIntoView({
|
document.querySelector(".lyric-line.active").scrollIntoView({
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
block: "center"
|
block: "center"
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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-if="player.lyrics">
|
||||||
<template v-for="lyric in player.lyrics" v-if="lyric.line != 'lrcInstrumental'">
|
<template v-for="lyric in player.lyrics" v-if="lyric.line != 'lrcInstrumental'">
|
||||||
<h3 class="lyric-line" @click="seekTo(lyric.startTime, false)"
|
<h3 class="lyric-line" @click="seekTo(lyric.startTime, false)"
|
||||||
|
@ -723,7 +723,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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-if="player.lyrics">
|
||||||
<template v-for="lyric in player.lyrics" v-if="lyric.line != 'lrcInstrumental'">
|
<template v-for="lyric in player.lyrics" v-if="lyric.line != 'lrcInstrumental'">
|
||||||
<h3 class="lyric-line" @click="seekTo(lyric.startTime, false)"
|
<h3 class="lyric-line" @click="seekTo(lyric.startTime, false)"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue