Преглед изворни кода

feat: 多轨渲染第一轨逻辑修改

TIANYONG пре 4 недеља
родитељ
комит
5a2eead2c2
1 измењених фајлова са 6 додато и 2 уклоњено
  1. 6 2
      src/helpers/formateMusic.ts

+ 6 - 2
src/helpers/formateMusic.ts

@@ -889,8 +889,12 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 	let differFrom = 0;
 	// let testIdx = 0;
 	let repeatIdx = 0; // 循环的次数
-	// 当多选声部的时候 ,取选择的第一个声部
-	const firstTrackName = state.combinePartIndexs.length>1 ? state.partListNames[state.combinePartIndexs[0]] : state.canSelectTracks[0] || "";
+	/**
+	 * 当多选声部的时候 ,取选择的第一个声部
+	 * 总谱渲染时,需要取第一个渲染的声轨名字,canSelectTracks返回的声轨名字可能不是第一个,顺序有问题,需要用state.osmd.Sheet.Instruments
+	 */
+	// const firstTrackName = state.combinePartIndexs.length>1 ? state.partListNames[state.combinePartIndexs[0]] : state.canSelectTracks[0] || "";
+	const firstTrackName = state.combinePartIndexs.length>1 ? state.partListNames[state.combinePartIndexs[0]] : (state.osmd.Sheet.Instruments[0].Name || state.osmd.Sheet.Instruments[0].NameLabel.text || "");
 	const currentTrackIndex = state.isCombineRender && state.combinePartIndexs.length > 1 ? state.combinePartIndexs[0] : 0;
 	while (!iterator.EndReached) {
 		// console.log({ ...iterator });