소스 검색

fix: #9875 bug修复

TIANYONG 1 년 전
부모
커밋
71de539f7a
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      src/helpers/metronome.ts

+ 8 - 1
src/helpers/metronome.ts

@@ -424,7 +424,14 @@ function calculateMetroStep(arr: any[], m: any): number[] {
 		if (exceedStep >= 1) {
 			totalLength -= clap;
 			// 一拍
-			const measure_bbox = item?.svgElement?.attrs?.el?.parentElement?.parentElement?.getBoundingClientRect?.() || { x: 0 };
+			let measure_bbox = item?.svgElement?.attrs?.el?.parentElement?.parentElement?.getBoundingClientRect?.() || { x: 0 };
+			/**
+			 * bug: #9875
+			 * 简谱,渲染有点问题,先使用vf-stave的位置
+			 */
+			if (state.musicRenderType !== "staff") {
+				measure_bbox = item?.svgElement?.attrs?.el?.parentElement?.parentElement?.querySelector('.vf-stave')?.getBoundingClientRect?.() || { x: 0 };
+			}			
 			if (notes.length > 0) {
 				let bbox = notes[0]?.svgElement?.attrs?.el?.getBoundingClientRect?.() || { x: 0 };
 				let x: any = bbox.x - measure_bbox.x;