Browse Source

Merge branch '2023-9-1_多选'

liushengqiang 1 year ago
parent
commit
142554608c
2 changed files with 14 additions and 5 deletions
  1. 4 0
      src/pc/home/component/the-setting/index.tsx
  2. 10 5
      src/pc/home/index.tsx

+ 4 - 0
src/pc/home/component/the-setting/index.tsx

@@ -99,6 +99,10 @@ export default defineComponent({
 				label: "撤回",
 				value: "Ctrl + z",
 			},
+			{
+				label: "多选",
+				value: "Shift",
+			},
 		];
 		return () => (
 			<NModal autoFocus={false} show={props.show} onUpdate:show={(val) => emit("update:show", val)}>

+ 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);
 					}
 				}
 			}