liushengqiang 1 年之前
父節點
當前提交
0cd1a20aa1
共有 2 個文件被更改,包括 24 次插入1 次删除
  1. 6 1
      osmd-extended/src/VexFlowPatch/src/dot.js
  2. 18 0
      osmd-extended/src/VexFlowPatch/src/stavenote.js

+ 6 - 1
osmd-extended/src/VexFlowPatch/src/dot.js

@@ -142,7 +142,12 @@ export class Dot extends Modifier {
     }
 
     const x = (start.x + this.x_shift) + this.width - this.radius;
-    const y = start.y + this.y_shift + (this.dot_shiftY * lineSpace);
+    let space = this.dot_shiftY * lineSpace
+    // 简谱 有附点
+    if ( this.note && this.note.DYMusicScoreType == 'jianpu' ) {
+      space = -5
+    }
+    const y = start.y + this.y_shift + space;
     const ctx = this.context;
 
     ctx.beginPath();

+ 18 - 0
osmd-extended/src/VexFlowPatch/src/stavenote.js

@@ -1240,6 +1240,24 @@ export class StaveNote extends StemmableNote {
       ) {
         continue;
       }
+
+      // 简谱 有附点
+      if (
+        modifier.note &&
+        modifier.note.DYMusicScoreType == 'jianpu' &&
+        modifier.getAttribute("type") === 'Dot'
+      ) {
+        try {
+          const start = modifier.note.getModifierStartXY(modifier.position, 0,
+            { forceFlagRight: true });
+            if (start.x - modifier.note.x < 9){
+              modifier.x_shift += 7
+            }
+        } catch (error) {
+          console.log("🚀 ~ error:", error)
+        }
+        
+      }
       notehead.applyStyle(ctx, noteheadStyle);
       modifier.setContext(ctx);
       modifier.drawWithStyle();