瀏覽代碼

fix(VexFlowMeasure): undefined engraving rules

The instance of the engraving rules can be found on either `staffLine` or `sourceMeasure`. This depends on which of them is defined.
Daniel Fürst 5 年之前
父節點
當前提交
c111774abc
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12 0
      src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

+ 12 - 0
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -39,6 +39,18 @@ export class VexFlowMeasure extends GraphicalMeasure {
     constructor(staff: Staff, staffLine: StaffLine = undefined, sourceMeasure: SourceMeasure = undefined) {
         super(staff, sourceMeasure, staffLine);
         this.minimumStaffEntriesWidth = -1;
+
+        /*
+         * There is no case in which `staffLine === undefined && sourceMeasure === undefined` holds.
+         * Hence, it is not necessary to specify an `else` case.
+         * One can verify this through a usage search for this constructor.
+         */
+        if (staffLine) {
+            this.rules = staffLine.ParentMusicSystem.rules;
+        } else if (sourceMeasure) {
+            this.rules = sourceMeasure.Rules;
+        }
+
         this.resetLayout();
     }