瀏覽代碼

feat(EngravingRules): Add optional EngravingRules argument to OSMD constructor, fix default voice listener always added (#55)

see discussion in e382b299a1013f0cce68299f7fd1985f8c316f7b
(osmd-extended) on Github
sschmidTU 3 年之前
父節點
當前提交
a991590c54
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 1 1
      src/MusicalScore/Graphical/EngravingRules.ts
  2. 3 1
      src/OpenSheetMusicDisplay/OpenSheetMusicDisplay.ts

+ 1 - 1
src/MusicalScore/Graphical/EngravingRules.ts

@@ -338,7 +338,7 @@ export class EngravingRules {
 
     public static FixStafflineBoundingBox: boolean; // TODO temporary workaround
 
-    // Playback
+    // Playback (these are not about "engraving", but EngravingRules are the one object that is available in most places in OSMD)
     public PlayAlreadyStartedNotesFromCursorPosition: boolean = false;
     /** The interval between current timer position and note timestamp beyond which notes are not played.
      * If you experience notes being skipped during playback, try increasing this interval slightly (e.g. 0.02 -> 0.03).

+ 3 - 1
src/OpenSheetMusicDisplay/OpenSheetMusicDisplay.ts

@@ -48,7 +48,9 @@ export class OpenSheetMusicDisplay {
      *                For defaults see the OSMDOptionsStandard method in the [[OSMDOptions]] class.
      */
     constructor(container: string | HTMLElement,
-                options: IOSMDOptions = OSMDOptions.OSMDOptionsStandard()) {
+                options: IOSMDOptions = OSMDOptions.OSMDOptionsStandard(),
+                rules: EngravingRules = new EngravingRules()) {
+        this.rules = rules;
         // Store container element
         if (typeof container === "string") {
             // ID passed