فهرست منبع

Fixes:
fixes for changes breaking across systems. Fix for issue where non-note pedal lines render with change slant. Fix for better end stave detection - detect on actual stave, not source measure

Justin Litten 3 سال پیش
والد
کامیت
1092af184f

+ 10 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -1071,6 +1071,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
           const lastNoteOfFirstShift: GraphicalStaffEntry = lastMeasureOfFirstShift.staffEntries[lastMeasureOfFirstShift.staffEntries.length - 1];
           graphicalPedal.setEndNote(lastNoteOfFirstShift);
           graphicalPedal.setEndMeasure(endMeasure);
+          graphicalPedal.ChangeEnd = false;
 
           const systemsInBetweenCount: number = endStaffLine.ParentMusicSystem.Id - startStaffLine.ParentMusicSystem.Id;
           if (systemsInBetweenCount > 0) {
@@ -1081,13 +1082,21 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
               const nextPedalStaffline: StaffLine = nextPedalMusicSystem.StaffLines[staffIndex];
               const nextPedalFirstMeasure: GraphicalMeasure = nextPedalStaffline.Measures[0];
               let nextOpenEnd: boolean = false;
+              let nextChangeEndFromParent: boolean = false;
               if (currentCount < systemsInBetweenCount) {
                 nextOpenEnd = true;
+              } else {
+                nextChangeEndFromParent = true;
               }
               currentCount++;
               // pedal starts on the first measure
               const nextPedal: VexFlowPedal = new VexFlowPedal(pedal, nextPedalFirstMeasure.PositionAndShape, true, nextOpenEnd);
-
+              nextPedal.ChangeBegin = false;
+              if(nextChangeEndFromParent){
+                nextPedal.ChangeEnd = pedal.ChangeEnd;
+              } else {
+                nextPedal.ChangeEnd = false;
+              }
               let nextPedalLastMeasure: GraphicalMeasure = nextPedalStaffline.Measures[nextPedalStaffline.Measures.length - 1];
               const firstNote: GraphicalStaffEntry = nextPedalFirstMeasure.staffEntries[0];
               let lastNote: GraphicalStaffEntry = nextPedalLastMeasure.staffEntries[nextPedalLastMeasure.staffEntries.length - 1];

+ 11 - 4
src/MusicalScore/Graphical/VexFlow/VexFlowPedal.ts

@@ -21,6 +21,8 @@ export class VexFlowPedal extends GraphicalPedal {
     public startVfVoiceEntry: VexFlowVoiceEntry;
     public endVfVoiceEntry: VexFlowVoiceEntry;
     public endMeasure: GraphicalMeasure;
+    public ChangeBegin: boolean = false;
+    public ChangeEnd: boolean = false;
     private line: number = -3;
 
     public EndSymbolPositionAndShape: BoundingBox = undefined;
@@ -31,6 +33,8 @@ export class VexFlowPedal extends GraphicalPedal {
      */
     constructor(pedal: Pedal, parent: BoundingBox, openBegin: boolean = false, openEnd: boolean = false) {
         super(pedal, parent);
+        this.ChangeBegin = pedal.ChangeBegin;
+        this.ChangeEnd = pedal.ChangeEnd;
         switch (this.pedalSymbol) {
             case MusicSymbol.PEDAL_SYMBOL:
                 //This renders the pedal symbols in VF.
@@ -68,6 +72,9 @@ export class VexFlowPedal extends GraphicalPedal {
      * @param graphicalStaffEntry the staff entry that holds the start note
      */
     public setStartNote(graphicalStaffEntry: GraphicalStaffEntry): boolean {
+        if(!graphicalStaffEntry){
+            return false;
+        }
         for (const gve of graphicalStaffEntry.graphicalVoiceEntries) {
             const vve: VexFlowVoiceEntry = (gve as VexFlowVoiceEntry);
             if (vve?.vfStaveNote) {
@@ -122,12 +129,12 @@ export class VexFlowPedal extends GraphicalPedal {
         pedalMarking.setLine(this.line);
         pedalMarking.setCustomText(this.DepressText, this.ReleaseText);
         //If our end note is at the end of a stave, set that value
-        if(this.endVfVoiceEntry?.parentStaffEntry?.parentMeasure?.parentSourceMeasure?.VerticalSourceStaffEntryContainers?.last() ===
-        this.endVfVoiceEntry?.parentVoiceEntry?.ParentSourceStaffEntry?.VerticalContainerParent){
+        if(this.endVfVoiceEntry?.parentStaffEntry === this.endVfVoiceEntry?.parentStaffEntry?.parentMeasure?.staffEntries.last() ||
+        !this.endVfVoiceEntry){
                 (pedalMarking as any).EndsStave = true;
         }
-        (pedalMarking as any).ChangeBegin = this.getPedal.ChangeBegin;
-        (pedalMarking as any).ChangeEnd = this.getPedal.ChangeEnd;
+        (pedalMarking as any).ChangeBegin = this.ChangeBegin;
+        (pedalMarking as any).ChangeEnd = this.ChangeEnd;
         return pedalMarking;
     }
 }

+ 1 - 1
src/VexFlowPatch/src/pedalmarking.js

@@ -283,7 +283,7 @@ export class PedalMarking extends Element {
         }
       } else {
         // Adjustment for release+depress
-        x_shift = next_is_same ? -5 : 0;
+        x_shift = next_is_same && !this.EndsStave ? -5 : 0;
 
         // Draw end bracket
         ctx.beginPath();