瀏覽代碼

VexFlowGraphicalNote: add getSVGGElement methods

part of #549
sschmid 5 年之前
父節點
當前提交
3dbe83b9f0
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalNote.ts

+ 16 - 0
src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalNote.ts

@@ -67,4 +67,20 @@ export class VexFlowGraphicalNote extends GraphicalNote {
     public Clef(): ClefInstruction {
     public Clef(): ClefInstruction {
         return this.clef;
         return this.clef;
     }
     }
+
+    /**
+     * Gets the id of the SVGGElement containing this note, given the SVGRenderer is used.
+     * This is for low-level rendering hacks and should be used with caution.
+     */
+    public getSVGId(): string {
+        return this.vfnote[0].getAttribute("id");
+    }
+
+    /**
+     * Gets the SVGGElement containing this note, given the SVGRenderer is used.
+     * This is for low-level rendering hacks and should be used with caution.
+     */
+    public getSVGGElement(): SVGGElement {
+        return this.vfnote[0].getAttribute("el");
+    }
 }
 }