Prechádzať zdrojové kódy

Merge branch 'feature/Expressions' of https://github.com/opensheetmusicdisplay/opensheetmusicdisplay into feature/Expressions

Benjamin Giesinger 6 rokov pred
rodič
commit
a7c21fbf11

+ 2 - 2
external/vexflow/vexflow.d.ts

@@ -6,14 +6,14 @@ declare namespace Vex {
         const RESOLUTION: any;
 
         export class Formatter {
-            constructor(opts?: any);
+            constructor();
 
             public hasMinTotalWidth: boolean;
             public minTotalWidth: number;
 
             public joinVoices(voices: Voice[]): void;
 
-            public format(voices: Voice[], width: number): void;
+            public format(voices: Voice[], width: number, options?: any): void;
 
             public preCalculateMinTotalWidth(voices: Voice[]): number;
         }

+ 4 - 3
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -90,8 +90,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
      }*/
     // Format the voices
     const allVoices: Vex.Flow.Voice[] = [];
-    const formatter: Vex.Flow.Formatter = new Vex.Flow.Formatter({align_rests: true,
-    });
+    const formatter: Vex.Flow.Formatter = new Vex.Flow.Formatter();
 
     for (const measure of measures) {
         const mvoices:  { [voiceID: number]: Vex.Flow.Voice; } = (measure as VexFlowMeasure).vfVoices;
@@ -124,7 +123,9 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
             const vexflowMeasure: VexFlowMeasure = (measure as VexFlowMeasure);
             // prepare format function for voices, will be called later for formatting measure again
             vexflowMeasure.formatVoices = (w: number) => {
-              formatter.format(allVoices, w);
+              formatter.format(allVoices, w, {
+                align_rests: true,
+          });
             };
             // format now for minimum width
             vexflowMeasure.formatVoices(minStaffEntriesWidth * unitInPixels);

+ 2 - 2
src/MusicalScore/VoiceData/SourceStaffEntry.ts

@@ -224,8 +224,8 @@ export class SourceStaffEntry {
                             tieRestDuration.Add(n.Length);
                         }
                     }
-                    if (duration.lt(note.NoteTie.Duration)) {
-                        duration = note.NoteTie.Duration;
+                    if (duration.lt(tieRestDuration)) {
+                        duration = tieRestDuration;
                     }
                 } else if (duration.lt(note.Length)) {
                     duration = note.Length;