feat: 连接歌词与实际播放进度

This commit is contained in:
Astrian Zheng 2025-08-22 20:53:42 +10:00
parent 2fdec7688b
commit 1b2b8541da
Signed by: Astrian
SSH Key Fingerprint: SHA256:rVnhx3DAKjujCwWE13aDl7uV6+9U1MvydLkNRXJrBiA

View File

@ -90,6 +90,7 @@ import { onMounted, ref, watch, nextTick, computed, onUnmounted } from 'vue'
import axios from 'axios' import axios from 'axios'
import gsap from 'gsap' import gsap from 'gsap'
import { usePlayQueueStore } from '../stores/usePlayQueueStore' import { usePlayQueueStore } from '../stores/usePlayQueueStore'
import { usePlayState } from '../stores/usePlayState'
import { debugLyrics } from '../utils/debug' import { debugLyrics } from '../utils/debug'
// //
@ -108,6 +109,7 @@ interface GapLine {
} }
const playQueueStore = usePlayQueueStore() const playQueueStore = usePlayQueueStore()
const playState = usePlayState()
// //
const parsedLyrics = ref<(LyricsLine | GapLine)[]>([]) const parsedLyrics = ref<(LyricsLine | GapLine)[]>([])
@ -482,7 +484,7 @@ function getGapDotOpacities(line: GapLine) {
const duration = line.duration ?? 0 const duration = line.duration ?? 0
if (duration <= 0) return [0.3, 0.3, 0.3] if (duration <= 0) return [0.3, 0.3, 0.3]
// //
const now = playQueueStore.currentTime const now = playState.playProgress
// gap // gap
const start = line.time const start = line.time
// //
@ -498,7 +500,7 @@ function getGapDotOpacities(line: GapLine) {
// //
watch( watch(
() => playQueueStore.currentTime, () => playState.playProgress,
(time) => { (time) => {
const newIndex = findCurrentLineIndex(time) const newIndex = findCurrentLineIndex(time)