Browse Source

修复:音符多选的 我按住Shift键 鼠标点击时,会一次把一个小节都选中

liushengqiang 1 year ago
parent
commit
8adda1104b
1 changed files with 10 additions and 5 deletions
  1. 10 5
      src/pc/home/index.tsx

+ 10 - 5
src/pc/home/index.tsx

@@ -302,6 +302,7 @@ export default defineComponent({
 			const start = data.multiSelectList[0];
 			const end = data.multiSelectList[1];
 			const list = [] as any[];
+			console.log("🚀 ~ start:", start.noteIndex, end.noteIndex);
 			for (let i = start.measureIndex; i < end.measureIndex + 1; i++) {
 				const measure = abcData.abc.measures[i];
 				for (let j = 0; j < measure.notes.length; j++) {
@@ -311,12 +312,16 @@ export default defineComponent({
 						measureIndex: i,
 						noteIndex: j,
 					};
-					if (start.measureIndex === i) {
-						j >= start.noteIndex && list.push(active);
-					} else if (i === end.measureIndex) {
-						j <= end.noteIndex && list.push(active);
+					if (start.measureIndex != end.measureIndex) {
+						if (start.measureIndex === i) {
+							j >= start.noteIndex && list.push(active);
+						} else if (i === end.measureIndex) {
+							j <= end.noteIndex && list.push(active);
+						} else {
+							list.push(active);
+						}
 					} else {
-						list.push(active);
+						j >= start.noteIndex && j <= end.noteIndex && list.push(active);
 					}
 				}
 			}