Bläddra i källkod

Merge branch '2023-8-28'

liushengqiang 1 år sedan
förälder
incheckning
3809b3b61c
1 ändrade filer med 22 tillägg och 4 borttagningar
  1. 22 4
      src/pc/home/runtime.ts

+ 22 - 4
src/pc/home/runtime.ts

@@ -308,13 +308,30 @@ const formateGetData = {
 		];
 		let _duration = noteType.find((n) => n.name === type)?.value || "";
 		const noteDuration: any = {
+			"0.046875": "1/6",
+			"0.09375": "1/3",
+			"0.1875": "2/3",
 			"0.375": "3/2",
-			"0.75": "3"
-		}
+			"0.75": "3",
+		};
 		if (_duration === "") {
 			_duration = noteDuration[duration] || "";
 		}
-		return _duration
+		return _duration;
+	},
+	getSegno(ele: any, nextEle: any) {
+		let segno = " ";
+		if (nextEle && ele) {
+			// console.log("🚀 ~ nextEle:", nextEle)
+			if (nextEle?.abselem?.beam?.elems && Array.isArray(nextEle.abselem.beam.elems)) {
+				const _ele = nextEle.abselem.beam.elems.find((n: any) => n.abcelem.startChar === ele.startChar);
+				// console.log("🚀 ~ elems:", _ele)
+				if (_ele) {
+					segno = "";
+				}
+			}
+		}
+		return segno;
 	},
 };
 
@@ -384,6 +401,7 @@ export const formateAbc = (visualObj: TuneObject, option: any) => {
 						const voice = staff.voices[k];
 						for (let l = 0; l < voice.length; l++) {
 							const element = voice[l];
+							const nextElement = voice[l + 1];
 							if (element.el_type === "bar") {
 								measureIndex++;
 								list.push(measure);
@@ -414,7 +432,7 @@ export const formateAbc = (visualObj: TuneObject, option: any) => {
 									accidental: "", // 临时升降记号
 									dot: "", //附点
 									tieline: "", // 延音线
-									segno: "", // 分割
+									segno: formateGetData.getSegno(element, nextElement), // 分割
 								};
 								if (element.rest) {
 									noteItem.content = "z";