瀏覽代碼

feat: osmd对象Instruments过滤掉common

TIANYONG 4 月之前
父節點
當前提交
150c0a49df
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 3 1
      src/helpers/formateMusic.ts
  2. 1 1
      vite.config.ts

+ 3 - 1
src/helpers/formateMusic.ts

@@ -907,8 +907,10 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 	 * 总谱渲染时,需要取第一个渲染的声轨名字,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 filterInstruments = state.osmd.Sheet.Instruments.filter(item => item.Name?.toLocaleLowerCase() !== 'common' )
+	const firstTrackName = state.combinePartIndexs.length>1 ? state.partListNames[state.combinePartIndexs[0]] : (filterInstruments[0].Name || filterInstruments[0].NameLabel.text || "");
 	const currentTrackIndex = state.isCombineRender && state.combinePartIndexs.length > 1 ? state.combinePartIndexs[0] : 0;
+
 	while (!iterator.EndReached) {
 		// console.log({ ...iterator });
 		/** 多声轨合并显示,当前音符的时值取所有声轨中的最小值 */

+ 1 - 1
vite.config.ts

@@ -81,7 +81,7 @@ export default defineConfig({
     // https: true,
     proxy: {
       "^/instrument/.*": {
-        target: "https://test.gym.lexiaoya.cn",
+        target: "https://gym.lexiaoya.cn",
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/instrument/, ""),
       },