Browse Source

Merge branch 'ktyq-fix-912' of http://git.dayaedu.com/liushengqiang/music-score into ktyq-online-new

TIANYONG 10 tháng trước cách đây
mục cha
commit
6286644f48
2 tập tin đã thay đổi với 23 bổ sung1 xóa
  1. 21 1
      src/helpers/formateMusic.ts
  2. 2 0
      src/view/fingering/fingering-config.ts

+ 21 - 1
src/helpers/formateMusic.ts

@@ -1264,7 +1264,27 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			 */
 			if (state.isEvxml && note.isRestFlag && note?.noteTimeInfo?.length === 0 && state.xmlHasTimes ) {
 				const idx = _notes.findIndex(item=>item.note === note);
-				const allowRange = Math.abs(_notes[idx+1]?.note?.noteTimeInfo?.[0]?.begin*1000 - _notes[idx-1]?.note?.noteTimeInfo?.[0]?.end*1000) < 10;
+				let nextNoteTimes = _notes[idx+1]?.note?.noteTimeInfo?.[0]?.begin*1000 
+				let preNoteTImes = _notes[idx-1]?.note?.noteTimeInfo?.[0]?.end*1000
+				// 当下一个音符也没有时间的时候,再往下一个找
+				if(!nextNoteTimes && nextNoteTimes!==0){
+					let nextIndex = idx + 2
+					while(!nextNoteTimes && nextIndex<_notes.length){
+						nextNoteTimes = _notes[nextIndex]?.note?.noteTimeInfo?.[0]?.begin*1000
+						nextIndex ++
+					}
+					// 当最后音符就是没有打时间的休止小节,可能nextNoteTimes时间找不到,目前没有处理
+				}
+				if(!preNoteTImes && preNoteTImes!==0){
+					let preIndex = idx - 2
+					while(!preNoteTImes && preIndex>-1){
+						preNoteTImes = _notes[preIndex]?.note?.noteTimeInfo?.[0]?.end*1000
+						preIndex --
+					}
+					// 当没有找到preNoteTImes的时候 赋值为0 (当第一个音符就是没有打时间的休止小节会出现这种情况)
+					preNoteTImes || (preNoteTImes = 0)
+				}
+				const allowRange = Math.abs(nextNoteTimes - preNoteTImes)< 10;
 				if (allowRange) {
 					note.maxNoteNum = note.maxNoteNum - 1;
 					// 唱名时间补齐,当删除这个音符的时候,上个音符的持续时间要加上这个音符的时间

+ 2 - 0
src/view/fingering/fingering-config.ts

@@ -173,6 +173,7 @@ export const mappingVoicePart = (id: number | string, soruce: "GYM" | "COLEXIU"
       "Alto Saxophone": 5,
       "Tenor Saxophone": 5,
       "Baritone Saxophone": 5,
+      "Baritone": 15,
       "Trumpet in Bb 1": 12,
       "Trumpet in Bb 2": 12,
       "Horn in F": 13,
@@ -280,6 +281,7 @@ export const matchVoicePart = (id: number | string, type: "SINGLE" | "CONCERT"):
       "Alto Saxophone2": 5,
       "Tenor Saxophone": 5,
       "Baritone Saxophone": 5,
+      "Baritone": 15,
       "Trumpet in Bb 1": 12,
       "Trumpet in Bb 2": 12,
       "Horn in F": 13,