Parcourir la source

fix:跟练模式,样式问题

liushengqiang il y a 2 ans
Parent
commit
e6865198af
1 fichiers modifiés avec 17 ajouts et 7 suppressions
  1. 17 7
      src/view/selection/index.tsx

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

@@ -1,5 +1,5 @@
 import { computed, defineComponent, onMounted, reactive, Transition } from "vue";
-import state, { handleSelection, skipNotePlay } from "/src/state";
+import state, { EnumMusicRenderType, handleSelection, skipNotePlay } from "/src/state";
 import styles from "./index.module.less";
 import { metronomeData } from "/src/helpers/metronome";
 import { evaluatingData } from "../evaluating";
@@ -49,12 +49,22 @@ const calcNoteData = () => {
 
 				if (noteEle) {
 					const noteBbox = noteEle.getBoundingClientRect?.() || { x: 0, width: 0 };
-					noteItem.bbox = {
-						left: noteBbox.x - parentLeft - noteBbox.width / 4 + "px",
-						top: staveBbox.y - parentTop + "px",
-						width: noteBbox.width * 1.5 + "px",
-						height: staveBbox.height + "px",
-					};
+					if (state.musicRenderType !== EnumMusicRenderType.staff) {
+						noteItem.bbox = {
+							left: noteBbox.x - parentLeft - noteBbox.width / 4 + "px",
+							top: noteBbox.y - parentTop - noteBbox.height + "px",
+							width: noteBbox.width * 1.5 + "px",
+							height: noteBbox.height * 3 + "px",
+						};
+					} else {
+						noteItem.bbox = {
+							left: noteBbox.x - parentLeft - noteBbox.width / 4 + "px",
+							top: staveBbox.y - parentTop + "px",
+							width: noteBbox.width * 1.5 + "px",
+							height: staveBbox.height + "px",
+						};
+					}
+					
 				}
 				selectData.notes.push(noteItem);
 				notesList.push(item.noteId);