Skip to content

Commit

Permalink
Fixed Autoscroll not stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick-web committed Feb 8, 2022
1 parent 833a486 commit 8eadb61
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion src/renderer/components/local-music/side-pane/lyrics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</p>
</div>
<div
v-if="playingTrackLyrics"
v-if="playingTrackLyrics && autoScroll"
class="lyrics"
>
<div
Expand All @@ -46,6 +46,27 @@
</p>
</div>
</div>

<div
v-if="playingTrackLyrics && !autoScroll"
class="lyrics-no-auto"
>
<div
v-for="(verse, index) in playingTrackLyrics"
:key="index"
class="verse"
>
<p
v-for="(line, lineIndex) in verseLines(verse)"
:key="lineIndex"
class="line"
>
{{ line }}
</p>
</div>
</div>


<div
v-if="playingTrackLyrics"
class="
Expand Down Expand Up @@ -115,6 +136,7 @@ export default {
return verse.replace(/\[.*\].*/gi, '').split(/\n/);
},
autoScrollContainer() {
console.log("Auto Scrolling")
if (this.autoScroll) {
const audio = document.querySelector('audio');
const percent = audio.currentTime / audio.duration;
Expand Down Expand Up @@ -157,6 +179,7 @@ export default {
this.getLyrics();
const audio = document.querySelector('audio');
audio.addEventListener('timeupdate', () => {
console.log(this.autoScroll)
if (this.autoScroll) {
this.autoScrollContainer();
}
Expand Down Expand Up @@ -220,6 +243,24 @@ export default {
}
// width: 100px;
}
.lyrics-no-auto {
font-family: inherit;
text-align: left;
overflow: hidden;
height: 90%;
width: 105%;
overflow-y: scroll;
.verse {
padding: 10px;
line-height: 1.5rem;
text-align: center;
.line {
text-align: center;
}
}
// width: 100px;
}
.lyr_controls {
width: 92%;
z-index: 5;
Expand Down

0 comments on commit 8eadb61

Please sign in to comment.