فهرست منبع

fix: #9921、#9978 bug修复

TIANYONG 1 سال پیش
والد
کامیت
1640e76a31
2فایلهای تغییر یافته به همراه14 افزوده شده و 5 حذف شده
  1. 1 1
      src/helpers/metronome.ts
  2. 13 4
      src/state.ts

+ 1 - 1
src/helpers/metronome.ts

@@ -363,7 +363,7 @@ class Metronome {
 		} catch (error) {
 			console.log(error);
 		}
-		console.log('节拍器',metroList, metroMeasure);
+		// console.log('节拍器',metroList, metroMeasure);
 		// 5.得到所有的节拍时间
 		metronomeData.metroList = metroList;
 		metronomeData.metroMeasure = metroMeasure;

+ 13 - 4
src/state.ts

@@ -406,7 +406,7 @@ const state = reactive({
   /** 用户选择的结束小节数 */
   userChooseEndIndex: 0,
   /** 重播小节集合信息 */
-  repeatInfo: [],  
+  repeatInfo: [] as any,  
   /** 多分轨的曲子,可支持筛选的分轨 */
   canSelectTracks: [] as any,
   /** 声部codeId */
@@ -889,9 +889,18 @@ export const setSection = (start: number, end: number, userSpeed?: number) => {
   console.log('能否重播',canRepeatInfo)
   const isCanRepeat = canRepeatInfo.canRepeat
   // 如果符合重播规则,但是lastEndNotes长度为1,则需要向前找,直到找到lastEndNotes长度为2
+  /**
+   * 如果符合重播规则,但是lastEndNotes长度为1,则需要向前找,直到找到lastEndNotes长度为2
+   * 2024.03.28 新增逻辑,如果当前选中的结束小节是跳房子,则不向前找,因为这种场景不符合重播规则(bug:#9921)
+   * TODO:通过vf-volta判断是否是跳房子
+   */
+  let isSkipVolta = false; // 结束小节是否是跳房子小节
+  if (lastEndNotes.length === 1) {
+    isSkipVolta = lastEndNotes[0]?.stave?.modifiers?.some((item: any) => item.getAttribute('type') === 'Volta')
+  }
   let currentEndNum: number = end
-  const lastEndIndex = state.repeatInfo[canRepeatInfo.repeatIdx]?.end || 0
-  while (isCanRepeat && lastEndNotes.length === 1 && lastEndNotes[0].MeasureNumberXML <= lastEndIndex) {
+  const lastEndIndex: any = state.repeatInfo[canRepeatInfo.repeatIdx]?.end || 0
+  while (isCanRepeat && lastEndNotes.length === 1 && lastEndNotes[0].MeasureNumberXML <= lastEndIndex && !isSkipVolta) {
     currentEndNum = currentEndNum - 1
     const newEndNotes = state.times.filter(
       (n: any) => n.noteElement.sourceMeasure.MeasureNumberXML == currentEndNum
@@ -924,7 +933,7 @@ export const hanldeDirectSelection = (list: any[]) => {
   state.sectionStatus = true;
   setTimeout(() => {
     state.section = formateSelectMearure(list);
-    // console.log(333333333,state.section)
+    console.log('选段小节',state.section)
   }, 500);
 };
 let offsetTop = 0;