فهرست منبع

Merge branch 'feature-patch' into gym-online

TIANYONG 3 ماه پیش
والد
کامیت
28b6160f57
3فایلهای تغییر یافته به همراه12 افزوده شده و 4 حذف شده
  1. 1 1
      osmd-extended
  2. 2 1
      src/helpers/formateMusic.ts
  3. 9 2
      src/view/selection/index.tsx

+ 1 - 1
osmd-extended

@@ -1 +1 @@
-Subproject commit 2932a178d64983901e533ffd0d6abb1a8235a046
+Subproject commit 251b2c2d7bf36880c97129563e86400f971485c8

+ 2 - 1
src/helpers/formateMusic.ts

@@ -1136,7 +1136,8 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 				notes.push(...n.Notes);
 				return notes;
 			}, [] as any);
-			voiceNotes = voiceNotes.filter((note: any) => !note.IsGraceNote)
+			// 过滤掉倚音和和弦音符
+			voiceNotes = voiceNotes.filter((note: any) => (!note.IsGraceNote && !note.IsChordNote) )
 			voiceNotes = voiceNotes.sort((a: any, b: any) => a?.length?.realValue - b?.length?.realValue);
 			currentTime = voiceNotes?.[0]?.length?.realValue || 0;
 

+ 9 - 2
src/view/selection/index.tsx

@@ -92,11 +92,18 @@ export default defineComponent({
 								}
 								
 							} else {
+								// 判断是否是滑音,滑音的宽度很大,会覆盖掉前面的音符区域,导致无法点击选中前一个音符,需要缩小滑音的点击区域
+								let vibratoReduceX = 0;
+								if (noteEle?.querySelector('.vf-vibrato')) {
+									vibratoReduceX = 50;
+								} else {
+									vibratoReduceX = 0;
+								}								
 								const needTransY = -(staveBbox.height - customBgBox.height) / 2 + "px";
 								noteItem.bbox = {
-									left: noteBbox.x - parentLeft - noteBbox.width / 4 + "px",
+									left: noteBbox.x - parentLeft - noteBbox.width / 4 + vibratoReduceX + "px",
 									top: customBgBox.y ? customBgBox.y - parentTop + "px" : staveBbox.y - parentTop + "px",
-									width: noteBbox.width * 1.5 + "px",
+									width: noteBbox.width * 1.5 - vibratoReduceX + "px",
 									height: staveBbox.height + "px",
 									x: item.bbox?.x,
 									y: item.bbox?.y,