|
@@ -1,5 +1,5 @@
|
|
|
import { defineComponent, onMounted, onUnmounted, reactive, ref, watch } from "vue";
|
|
|
-import state, { gotoNext, resetPlaybackToStart, followBeatPaly, skipNotePlay } from "/src/state";
|
|
|
+import state, { gotoNext, resetPlaybackToStart, followBeatPaly, skipNotePlay, initSetPlayRate } from "/src/state";
|
|
|
import { IPostMessage } from "/src/utils/native-message";
|
|
|
import { api_cloudFollowTime, api_cloudToggleFollow } from "/src/helpers/communication";
|
|
|
import { storeData } from "/src/store";
|
|
@@ -119,6 +119,7 @@ export const handleFollowStart = async () => {
|
|
|
followData.start = true;
|
|
|
followData.index = 0;
|
|
|
followData.list = [];
|
|
|
+ initSetPlayRate();
|
|
|
resetPlaybackToStart();
|
|
|
openToggleRecord(true);
|
|
|
getNoteIndex();
|
|
@@ -138,6 +139,18 @@ export const handleFollowEnd = () => {
|
|
|
console.log("结束");
|
|
|
};
|
|
|
|
|
|
+// 清除当前音符右侧的音符的颜色状态
|
|
|
+const clearRightNoteColor = () => {
|
|
|
+ const noteId = state.times[state.activeNoteIndex]?.id;
|
|
|
+ const leftVal = document.getElementById(`vf-${noteId}`)?.getBoundingClientRect()?.left || 0;
|
|
|
+ state.times.forEach((item: any) => {
|
|
|
+ const note: HTMLElement = document.getElementById(`vf-${item.id}`)!;
|
|
|
+ if (note?.getBoundingClientRect()?.left > leftVal) {
|
|
|
+ note.classList.remove("follow-up", "follow-down", "follow-error", "follow-success");
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 2024.6.17 新增自动结束跟练模式功能
|
|
|
* 如果跟练模式,唱完了最后一个有频率的音符,需要自动结束掉跟练模式
|
|
@@ -156,6 +169,7 @@ const autoEndFollow = () => {
|
|
|
handleFollowEnd()
|
|
|
return
|
|
|
}
|
|
|
+ clearRightNoteColor();
|
|
|
}
|
|
|
|
|
|
// 下一个
|
|
@@ -265,6 +279,7 @@ export const skipNotePractice = () => {
|
|
|
noteFollows.forEach((noteFollow) => {
|
|
|
noteFollow?.classList.remove("follow-up", "follow-down", "follow-error");
|
|
|
})
|
|
|
+ clearRightNoteColor();
|
|
|
}
|
|
|
|
|
|
// 移动到对应音符的位置
|