Browse Source

feat: 滑音点击区域修改

TIANYONG 2 months ago
parent
commit
8eb1974095
2 changed files with 8 additions and 6 deletions
  1. 1 1
      osmd-extended
  2. 7 5
      src/view/selection/index.tsx

+ 1 - 1
osmd-extended

@@ -1 +1 @@
-Subproject commit 251b2c2d7bf36880c97129563e86400f971485c8
+Subproject commit 727729315b605fcb615570b822952decbbf63a08

+ 7 - 5
src/view/selection/index.tsx

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