Browse Source

fix: bug修复

TIANYONG 11 months ago
parent
commit
f172cf09d7

+ 3 - 1
src/helpers/formateMusic.ts

@@ -1218,6 +1218,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			if (svgElement?.modifiers?.length) {
 				hasGraceNote = svgElement?.modifiers.some((item: any) => item?.attrs?.type === "GraceNoteGroup")
 			}
+			const filterRepeatIdx = allNotes.filter((item: any) => item.noteId === note.NoteToGraphicalNoteObjectId).length
 			const nodeDetail = {
 				isStaccato: note.voiceEntry.isStaccato(),
 				isRestFlag: note.isRestFlag,
@@ -1265,7 +1266,8 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 				totalMultipleRestMeasures, // 当前小节总的合并小节数
 				measureSpeed,  // 小节速度
 				maxNoteNum: note.maxNoteNum, // 当前小节音符最多的分轨的音符数量
-				repeatIdx: iterator.repeatIdx || 0, // 标记是第几遍循环,从0开始
+				// repeatIdx: iterator.repeatIdx || 0, // 标记是第几遍循环,从0开始
+				repeatIdx: filterRepeatIdx,
 				xmlNoteTime: retain(xmlNoteTime), // xml上音符开始时间 唱名用
 				xmlNoteEndTime: retain(xmlNoteTime + noteLength), //xml上音符结束时间 唱名用
 				xmlMp3BeatFixTime,  //xml上节拍器的时间

+ 4 - 1
src/page-instrument/header-top/index.tsx

@@ -494,7 +494,10 @@ export default defineComponent({
       /** 作业模式 end */
       if (state.defaultModeType == 1) {
         headTopData.handleChangeModeType("practise");
-        if (state.platform === IPlatform.PC || state.isPreView) {
+        // if (state.platform === IPlatform.PC || state.isPreView) {
+        //   headTopData.showBack = false;
+        // }
+        if (state.isPreView) {
           headTopData.showBack = false;
         }
       } else {

+ 4 - 3
src/state.ts

@@ -1533,9 +1533,9 @@ const setState = (data: any, index: number) => {
   let pitchTrack = null
   if (state.isConcert) {
     musicalCode = musicalInstrumentCodeInfo.find((item: any) => item.id === state.musicalCodeId)?.code
-    pitchTrack = data.musicalInstruments?.find((item: any) => item.code === musicalCode)
+    pitchTrack = data.musicalInstruments?.find((item: any) => item.code?.split(',')[0] === musicalCode)
   } else {
-    pitchTrack = data.musicalInstruments?.find((item: any) => item.code === musicalCode)
+    pitchTrack = data.musicalInstruments?.find((item: any) => item.code?.split(',')[0] === musicalCode)
   }
   let musicalRenderType = ''
   // if (pitchTrack?.defaultScore) {
@@ -1703,7 +1703,8 @@ export const fillWordColor = () => {
   })
   const currentLyrics: SVGAElement[] = Array.from(document.querySelectorAll(`.lyric${currentNote?.noteId}`));
   currentLyrics.forEach((lyric, index) => {
-    if (index === currentNote.repeatIdx) {
+    const lyricIndex = lyric.getAttribute('lyricIndex');
+    if ((index === currentNote.repeatIdx && currentNote.repeatIdx + 1 == lyricIndex) || (currentNote.repeatIdx > 0 && currentNote.formatLyricsEntries?.length === 1)) {
       lyric?.classList.add('lyricActive')
     }
   })

+ 9 - 1
src/view/fingering/fingering-config.ts

@@ -272,6 +272,8 @@ export const matchVoicePart = (id: number | string, type: "SINGLE" | "CONCERT"):
       "Bass Clarinet in Bb": 4,
       Bassoon: 1,
       "Alto Saxophone": 5,
+      "Alto Saxophone1": 5,
+      "Alto Saxophone2": 5,
       "Tenor Saxophone": 5,
       "Baritone Saxophone": 5,
       "Trumpet in Bb 1": 12,
@@ -336,7 +338,13 @@ export const matchVoicePart = (id: number | string, type: "SINGLE" | "CONCERT"):
       code = code.toLocaleLowerCase().replace(/ /g, "");
       for (let sKey in subject) {
         let pitchKey = sKey;
-        if (typeof sKey === "string") pitchKey = pitchKey.toLocaleLowerCase().replace(/ /g, "");
+        if (typeof sKey === "string") {
+          pitchKey = pitchKey.toLocaleLowerCase().replace(/ /g, "");
+        }
+        if (typeof sKey === "string") {
+          // 去掉声轨后面的数字
+          code = code.replace(/[_0-9]+$/, '');
+        }
         if (pitchKey === code) {
           _track = subject[sKey];
           break;