Ver Fonte

fix: fixed breaking the system if the last measure has an endline (thin-bold line)
System stretching seems to not work still for these ending systems...

Matthias Uiberacker há 5 anos atrás
pai
commit
9d9835703a

+ 7 - 4
src/MusicalScore/Graphical/MusicSystemBuilder.ts

@@ -54,7 +54,6 @@ export class MusicSystemBuilder {
     }
 
     public buildMusicSystems(): MusicSystem[] {
-        let previousMeasureEndsSystem: boolean = false;
         const systemMaxWidth: number = this.getFullPageSystemWidth();
         this.measureListIndex = 0;
         this.currentSystemParams = new SystemBuildParameters();
@@ -124,14 +123,18 @@ export class MusicSystemBuilder {
                 );
                 this.updateActiveClefs(sourceMeasure, graphicalMeasures);
                 this.measureListIndex++;
+                if (sourceMeasureEndsSystem) {
+                    this.finalizeCurrentAndCreateNewSystem(graphicalMeasures, true);
+                }
             } else {
                 // finalize current system and prepare a new one
-                this.finalizeCurrentAndCreateNewSystem(graphicalMeasures, previousMeasureEndsSystem, doXmlPageBreak);
+                this.finalizeCurrentAndCreateNewSystem(graphicalMeasures, false, doXmlPageBreak);
                 // don't increase measure index to check this measure now again
             }
-            previousMeasureEndsSystem = sourceMeasureEndsSystem;
         }
-        this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length - 1], true, false);
+        if (this.currentSystemParams.systemMeasures.length > 0) {
+            this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length - 1], true);
+        }
         return this.musicSystems;
     }
 

+ 1 - 2
src/MusicalScore/ScoreIO/InstrumentReader.ts

@@ -493,8 +493,7 @@ export class InstrumentReader {
           }
         } else if (xmlNode.name === "barline") {
           if (this.repetitionInstructionReader !== undefined) {
-           const measureEndsSystem: boolean = false;
-           this.repetitionInstructionReader.handleLineRepetitionInstructions(xmlNode, measureEndsSystem);
+           const measureEndsSystem: boolean = this.repetitionInstructionReader.handleLineRepetitionInstructions(xmlNode);
            if (measureEndsSystem) {
              this.currentMeasure.BreakSystemAfter = true;
              this.currentMeasure.endsPiece = true;

+ 3 - 2
src/MusicalScore/ScoreIO/MusicSymbolModules/RepetitionInstructionReader.ts

@@ -28,8 +28,8 @@ export class RepetitionInstructionReader {
     this.currentMeasureIndex = currentMeasureIndex;
   }
 
-  public handleLineRepetitionInstructions(barlineNode: IXmlElement, pieceEndingDetected: boolean): void {
-    pieceEndingDetected = false;
+  public handleLineRepetitionInstructions(barlineNode: IXmlElement): boolean {
+    let pieceEndingDetected: boolean = false;
     if (barlineNode.elements().length > 0) {
       let location: string = "";
       let hasRepeat: boolean = false;
@@ -116,6 +116,7 @@ export class RepetitionInstructionReader {
         }
       }
     }
+    return pieceEndingDetected;
   }
 
   public handleRepetitionInstructionsFromWordsOrSymbols(directionTypeNode: IXmlElement, relativeMeasurePosition: number): boolean {