Bladeren bron

fix: 渐变小节取索引值

TIANYONG 6 maanden geleden
bovenliggende
commit
ecc9460bcf
1 gewijzigde bestanden met toevoegingen van 3 en 3 verwijderingen
  1. 3 3
      src/helpers/formateMusic.ts

+ 3 - 3
src/helpers/formateMusic.ts

@@ -1121,8 +1121,8 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 					// 范围内小节
 					const inFiestOrLastMeasure = first.closedMeasureIndex !== measureListIndex && last.closedMeasureIndex !== measureListIndex;
 					if (inTheFirstMeasure || inTheLastMeasure || inFiestOrLastMeasure) {
-						const startTime = state.gradualTimes[first.measureIndex+1];
-						const endTime = state.gradualTimes[last.measureIndex+1];
+						const startTime = state.gradualTimes[first.measureIndex];
+						const endTime = state.gradualTimes[last.measureIndex];
 						if (startTime && endTime) {
 							const times = continuous - first.leftDuration / first.allDuration + last.leftDuration / last.allDuration;
 							const diff = dayjs(tranTime(endTime)).diff(dayjs(tranTime(startTime)), "millisecond");
@@ -1260,7 +1260,7 @@ 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 - _notes[idx-1]?.note?.noteTimeInfo?.[0]?.end) < 10;
+				const allowRange = Math.abs(_notes[idx+1]?.note?.noteTimeInfo?.[0]?.begin*1000 - _notes[idx-1]?.note?.noteTimeInfo?.[0]?.end*1000) < 10;
 				if (allowRange) {
 					note.maxNoteNum = note.maxNoteNum - 1;
 					// 唱名时间补齐,当删除这个音符的时候,上个音符的持续时间要加上这个音符的时间