Sfoglia il codice sorgente

Merge branch 'feature-tianyong-newVersion' into ktyq-test-new

TIANYONG 7 mesi fa
parent
commit
4154cef6d7

+ 1 - 1
osmd-extended

@@ -1 +1 @@
-Subproject commit 6106f19f06cc5815d2f2069a1370cac1cb228d8e
+Subproject commit f757e1c4b7125efbdf514db6a6835335829d20ec

+ 5 - 4
src/state.ts

@@ -1281,12 +1281,13 @@ export const scrollViewNote = () => {
   const domId = "vf" + noteId;
   const cursorElement: any = document.querySelector(`[data-vf=${domId}]`)?.parentElement;
   const musicAndSelection = document.getElementById(state.scrollContainer)!;
+  const noteCenterOffsetTop = cursorElement ? cursorElement?.offsetTop + (cursorElement?.offsetHeight/2) : 0;
   // console.log('滑动',cursorElement.offsetTop,offsetTop, cursorElement, )
-  if (!cursorElement || !musicAndSelection || offsetTop === cursorElement.offsetTop || Math.abs(offsetTop - cursorElement.offsetTop) < 30) return;
-  offsetTop = cursorElement.offsetTop;
-  if (offsetTop > 50) {
+  if (!cursorElement || !noteCenterOffsetTop || !musicAndSelection || offsetTop === noteCenterOffsetTop || Math.abs(offsetTop - noteCenterOffsetTop) < 30) return;
+  offsetTop = noteCenterOffsetTop;
+  if (offsetTop > 100) {
     musicAndSelection.scrollTo({
-      top: (offsetTop - 50) * state.musicZoom,
+      top: (offsetTop - 100) * state.musicZoom,
       behavior: "smooth",
     });
   } else {

+ 1 - 1
src/view/music-score/index.tsx

@@ -257,7 +257,7 @@ export default defineComponent({
 				]}
 			>
 				{slots.default?.()}
-				{props.showSelection && musicData.showSelection && !state.isPreView && !state.isEvaluatReport &&!state.isSimplePage && <Selection />}
+				{props.showSelection && musicData.showSelection && !state.isPreView && !state.isEvaluatReport &&!state.isSimplePage && state.musicRendered && <Selection />}
 			</div>
 		);
 	},

+ 1 - 0
src/view/plugins/move-music-score/index.tsx

@@ -73,6 +73,7 @@ function initSvgId() {
 	const vfstaveSection: HTMLElement[] = []; //Array.from(svg.querySelectorAll(".vf-StaveSection"));
 	const vfRepetition: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-Repetition"));
 	const vflineGroup: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-lineGroup"));
+	// console.log('速度标记',vfstavetempo)
 	let tempIndex = 1;
 	[...vfstavetempo].forEach((ele) => {
 		setEleId(ele, "temp" + tempIndex);

+ 3 - 1
src/view/plugins/toggleMusicSheet/index.tsx

@@ -37,7 +37,9 @@ export default defineComponent({
           sortId,
           canselect
         }
-      }).filter((item: any) => item.canselect).sort((a: any, b: any) => a.sortId - b.sortId)
+      }).filter((item: any) => item.canselect)
+      // 不需要自定义排序,改为按照xml声轨顺序显示
+      // .sort((a: any, b: any) => a.sortId - b.sortId)
       // 支持总谱渲染的时候 加上总谱字段
       state.isScoreRender && arr.unshift({canselect:true, sortId:999, text: "总谱", value: 999})
       return arr

+ 4 - 1
src/view/selection/index.tsx

@@ -255,7 +255,10 @@ export default defineComponent({
 			// 初始化谱面可移动的元素位置
 			try {
 			moveData.partIndex = state.partIndex + ""
-			nextTick(() => renderForMoveData())
+			// 速度标记元素和谱面并非同时渲染,初始化可移动元素的时候,需要加个延迟
+			setTimeout(() => {
+				renderForMoveData()
+			}, 0);
 			} catch (error) {}
 		});
 		return () => (