|
@@ -1204,6 +1204,7 @@ const getMusicInfo = async (res: any) => {
|
|
|
index = tracks.findIndex(item => { // 筛选出当前的index
|
|
|
return item === musicObj?.track
|
|
|
})
|
|
|
+ index = index >= 0 ? index : 0;
|
|
|
const musicInfo = {
|
|
|
...res.data,
|
|
|
track: musicObj?.track
|
|
@@ -1533,6 +1534,19 @@ export const moveSvgDom = (skipNote?: boolean) => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ // 给当前匹配到的歌词添加颜色
|
|
|
+ const currentNote = state.times[state.activeNoteIndex];
|
|
|
+ const lyrics: SVGAElement[] = Array.from(document.querySelectorAll(".vf-lyric"));
|
|
|
+ lyrics.forEach((lyric) => {
|
|
|
+ lyric?.classList.remove('lyricActive')
|
|
|
+ })
|
|
|
+ const currentLyrics: SVGAElement[] = Array.from(document.querySelectorAll(`.lyric${currentNote?.noteId}`));
|
|
|
+ currentLyrics.forEach((lyric, index) => {
|
|
|
+ if (index === currentNote.repeatIdx) {
|
|
|
+ lyric?.classList.add('lyricActive')
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
/**
|
|
|
* 计算需要移动的距离
|
|
|
* 当前选中的音符和第一个音符之间的间距
|