|
@@ -668,7 +668,7 @@ export const onEnded = () => {
|
|
|
const dynamicShowPlaySpeed = (index: number, isPlaying?: boolean) => {
|
|
|
if (!headerColumnHide.value) {
|
|
|
const item: any = state.times[index];
|
|
|
- if (state.section.length === 2 && item.MeasureNumberXML === state.sectionFirst.MeasureNumberXML) {
|
|
|
+ if (state.sectionFirst && state.section.length === 2 && item.MeasureNumberXML === state.sectionFirst.MeasureNumberXML) {
|
|
|
state.speed = Math.floor(state.section[0].measureSpeed * state.basePlayRate) || state.speed
|
|
|
return;
|
|
|
}
|
|
@@ -1058,6 +1058,16 @@ export const gotoNext = (note: any, skipNote?: boolean) => {
|
|
|
state.activeNoteIndex = num;
|
|
|
state.activeMeasureIndex = note.MeasureNumberXML;
|
|
|
osmd.cursor.activeMeasureNum = note.MeasureNumberXML;
|
|
|
+ // 赋值音符id
|
|
|
+ osmd.cursor.noteGraphicalId = state.times[state.activeNoteIndex].id;
|
|
|
+ // 设置光标位置
|
|
|
+ nextTick(() => {
|
|
|
+ if (osmd.cursor.noteGraphicalId) {
|
|
|
+ const { x, y } = document.getElementById(`vf-${osmd.cursor.noteGraphicalId}`)?.getBoundingClientRect() || { x: 0, y: 0}
|
|
|
+ osmd.cursor.cursorElement.style.left = x + "px";
|
|
|
+ // cursorElement.style.top = y + "px";
|
|
|
+ }
|
|
|
+ })
|
|
|
dynamicShowPlaySpeed(state.activeNoteIndex);
|
|
|
if (prev && num - prev === 1) {
|
|
|
// console.log('跳转音符',11111,osmd.cursor)
|
|
@@ -2263,7 +2273,7 @@ watch(
|
|
|
}
|
|
|
)
|
|
|
|
|
|
- // 完成拖动弹窗引导页
|
|
|
+// 完成拖动弹窗引导页
|
|
|
export const handleGuide = async () => {
|
|
|
const guideInfoStore = localStorage.getItem('guideInfo') ? JSON.parse(localStorage.getItem('guideInfo')) : {};
|
|
|
guideInfoStore.teacherDrag = true;
|
|
@@ -2273,4 +2283,26 @@ export const handleGuide = async () => {
|
|
|
} catch (e) {
|
|
|
console.log(e);
|
|
|
}
|
|
|
-};
|
|
|
+};
|
|
|
+
|
|
|
+export const resetCursorPosition = () => {
|
|
|
+ if (metronomeData.cursorMode === 1) {
|
|
|
+ const currentActive = document.querySelector(`.dotActive`);
|
|
|
+ currentActive?.classList.remove('dotActive');
|
|
|
+ const currentDot = document.querySelector(`.noteIndex_${state.activeNoteIndex}`)
|
|
|
+ if (currentDot) {
|
|
|
+ currentDot.classList.add('dotActive')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const currentActive = document.querySelector(`.dotActive`);
|
|
|
+ currentActive?.classList.remove('dotActive');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => state.activeNoteIndex,
|
|
|
+ () => {
|
|
|
+ resetCursorPosition();
|
|
|
+ }
|
|
|
+);
|