Просмотр исходного кода

feat(percussion_stafflines) Correction for test failure, formatting

Justin Litten 5 лет назад
Родитель
Сommit
9157b20669

+ 3 - 5
src/MusicalScore/Graphical/MusicSheetCalculator.ts

@@ -1932,8 +1932,8 @@ export abstract class MusicSheetCalculator {
         let measure: GraphicalMeasure = undefined;
         //If the rule is set to render only one line for percussion clefs, and we have percussion clef, do so
         if (this.rules.RenderPercussionOneLine && activeClefs[staffIndex].ClefType === ClefEnum.percussion) {
-            staff.StafflineCount = 1;
-          }
+          staff.StafflineCount = 1;
+        }
         if (activeClefs[staffIndex].ClefType === ClefEnum.TAB) {
             staff.isTab = true;
             measure = MusicSheetCalculator.symbolFactory.createTabStaffMeasure(sourceMeasure, staff);
@@ -2081,9 +2081,7 @@ export abstract class MusicSheetCalculator {
                                                                                                  new ClefInstruction(),
                                                                                                  OctaveEnum.NONE, undefined);
                 const staffLineCount: number = voiceEntry.ParentSourceStaffEntry.ParentStaff.StafflineCount;
-                graphicalNote = MusicSheetCalculator.stafflineNoteCalculator.positionNote(graphicalNote,
-                                                                                          activeClefs[staffIndex],
-                                                                                          staffLineCount);
+                graphicalNote = MusicSheetCalculator.stafflineNoteCalculator.positionNote(graphicalNote, activeClefs[staffIndex], staffLineCount);
                 gve.notes.push(graphicalNote);
             }
         }

+ 4 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -107,7 +107,10 @@ export class VexFlowMeasure extends GraphicalMeasure {
             space_above_staff_ln: 0,
             space_below_staff_ln: 0,
         });
-        this.setLineNumber(this.ParentStaff.StafflineCount);
+
+        if (this.ParentStaff !== undefined) {
+            this.setLineNumber(this.ParentStaff.StafflineCount);
+        }
         // constructor sets beginning and end bar type to standard
 
         this.stave.setBegBarType(Vex.Flow.Barline.type.NONE); // technically not correct, but we'd need to set the next measure's beginning bar type