Parcourir la source

fix(Layout): fix lyrics dashes causing errors with drawUpToMeasureNumber (#838), fix dynamic expressions missing

this was only intended as a fix for #838, where the lyricExtend crashed because the endStaffline was undefined.

For some reason, this draws a whole lot more dynamic expressions like crescendo wedges in the Haydn sample,
which before the changed stopped appearing after a certain point.
sschmid il y a 4 ans
Parent
commit
1128c8b748
1 fichiers modifiés avec 8 ajouts et 4 suppressions
  1. 8 4
      src/MusicalScore/Graphical/MusicSheetCalculator.ts

+ 8 - 4
src/MusicalScore/Graphical/MusicSheetCalculator.ts

@@ -2719,13 +2719,16 @@ export abstract class MusicSheetCalculator {
                 break;
             }
             endStaffEntry = gse;
-            endStaffLine = <StaffLine>endStaffEntry.parentMeasure.ParentStaffLine;
+            endStaffLine = endStaffEntry.parentMeasure.ParentStaffLine;
+            if (!endStaffLine) {
+                endStaffLine = startStaffEntry.parentMeasure.ParentStaffLine;
+            }
         }
-        if (!endStaffEntry) {
+        if (!endStaffEntry || !endStaffLine) {
             return;
         }
         // if on the same StaffLine
-        if (startStaffLine === endStaffLine) {
+        if (startStaffLine === endStaffLine && endStaffEntry.parentMeasure.ParentStaffLine) {
             // start- and End margins from the text Labels
             const startX: number = startStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x +
                 startStaffEntry.PositionAndShape.RelativePosition.x +
@@ -2758,7 +2761,8 @@ export abstract class MusicSheetCalculator {
                 return;
             }
             // second Underscore in the endStaffLine until endStaffEntry (if endStaffEntry isn't the first StaffEntry of the StaffLine))
-            if (!(endStaffEntry === endStaffEntry.parentMeasure.staffEntries[0] &&
+            if (endStaffEntry.parentMeasure.ParentStaffLine && endStaffEntry.parentMeasure.staffEntries &&
+                !(endStaffEntry === endStaffEntry.parentMeasure.staffEntries[0] &&
                 endStaffEntry.parentMeasure === endStaffEntry.parentMeasure.ParentStaffLine.Measures[0])) {
                 const secondStartX: number = endStaffLine.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x;
                 const secondEndX: number = endStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x +