|
@@ -362,7 +362,7 @@ export const isRepeatWord = (text: string): boolean => {
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
-export const onlyVisible = (xml: string, partIndex: number): string => {
|
|
|
+export const onlyVisible = (xml: string, partIndex: number, resourceType?: string): string => {
|
|
|
if (!xml) return "";
|
|
|
// console.log('原始xml')
|
|
|
const detailId = state.examSongId + "";
|
|
@@ -500,6 +500,16 @@ export const onlyVisible = (xml: string, partIndex: number): string => {
|
|
|
|
|
|
// 最后一个小节的结束线元素不在最后 调整
|
|
|
if (part && part.getAttribute("id") === id) {
|
|
|
+ if (!resourceType) {
|
|
|
+ const backups = Array.from(part.getElementsByTagName('backup')) || []
|
|
|
+ for (let backup of backups) {
|
|
|
+ // @ts-ignore
|
|
|
+ if (backup && backup?.getElementsByTagName('duration')?.length) {
|
|
|
+ state.isSingleMutliTrack = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
const barlines = part.getElementsByTagName("barline");
|
|
|
const lastParent = barlines[barlines.length - 1]?.parentElement;
|
|
|
if (lastParent?.lastElementChild?.tagName !== "barline") {
|
|
@@ -913,6 +923,12 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
|
|
|
return trackName?.trim() === firstTrackName
|
|
|
});
|
|
|
}
|
|
|
+ // 多轨合并显示,或者单轨多声部的情况,需要过滤掉下半边声部的音符
|
|
|
+ if ( ((!state.isCombineRender && state.isSingleMutliTrack) || state.isCombineRender) && iterator.currentVoiceEntries.length) {
|
|
|
+ iterator.currentVoiceEntries = iterator.currentVoiceEntries.filter((item: any) => {
|
|
|
+ return item.ParentVoice.voiceId === 1
|
|
|
+ });
|
|
|
+ }
|
|
|
let minIndex = 0, elRealValue = 0
|
|
|
for (let index = 0; index < iterator.currentVoiceEntries.length; index++) {
|
|
|
const element = iterator.currentVoiceEntries[index];
|
|
@@ -1514,6 +1530,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
|
|
|
// console.log(note.sourceMeasure.MeasureNumberXML, note.sourceMeasure.verticalSourceStaffEntryContainers.length)
|
|
|
// console.log('👀看看endtime', nodeDetail.duration, relaEndtime, fixtime, i)
|
|
|
// console.log('音符时间',nodeDetail.i,nodeDetail.time,nodeDetail.endtime)
|
|
|
+
|
|
|
tickables = tickables.filter((tickable: any) => tickable.attrs?.type !== "GhostNote")
|
|
|
let maxNum = (state.isCombineRender && note.maxNoteNum) ? note.maxNoteNum : tickables.length;
|
|
|
// 妙极客的曲子,一个休止小节内可能有多个休止符,此时maxNum是0,需要针对这种情况作处理
|