Sfoglia il codice sorgente

feat(options): add EngravingRules.PageBottomExtraWhiteSpace (#788). merge #822

PageBottomMargin: add new isolated option PageBottomExtraWhiteSpace (#822)

squashed commits merged:

* PageBottomMargin: experimental: add margin to bottom of sheet (#788)

WIP, idea for #788

* PageBottomMargin: add new option PageBottomExtraWhiteSpace as isolated option for #788

* remove blank line

Co-authored-by: sschmid <s.schmid@phonicscore.com>
Simon 5 anni fa
parent
commit
6e5ae88b4b

+ 8 - 0
src/MusicalScore/Graphical/EngravingRules.ts

@@ -27,6 +27,7 @@ export class EngravingRules {
     private pageTopMargin: number;
     private pageTopMarginNarrow: number;
     private pageBottomMargin: number;
+    private pageBottomExtraWhiteSpace: number; // experimental. extra white space that wil be added below the sheet
     private pageLeftMargin: number;
     private pageRightMargin: number;
     private titleTopDistance: number;
@@ -263,6 +264,7 @@ export class EngravingRules {
         this.pageTopMargin = 5.0;
         this.pageTopMarginNarrow = 0.0; // for compact mode
         this.pageBottomMargin = 5.0;
+        this.pageBottomExtraWhiteSpace = 0.0; // experimental.
         this.pageLeftMargin = 5.0;
         this.pageRightMargin = 5.0;
         this.titleTopDistance = 9.0;
@@ -590,6 +592,12 @@ export class EngravingRules {
     public set PageBottomMargin(value: number) {
         this.pageBottomMargin = value;
     }
+    public get PageBottomExtraWhiteSpace(): number {
+        return this.pageBottomExtraWhiteSpace;
+    }
+    public set PageBottomExtraWhiteSpace(value: number) {
+        this.pageBottomExtraWhiteSpace = value;
+    }
     public get PageLeftMargin(): number {
         return this.pageLeftMargin;
     }

+ 19 - 0
src/MusicalScore/Graphical/MusicSystemBuilder.ts

@@ -1140,6 +1140,25 @@ export class MusicSystemBuilder {
         if (timesPageCouldntFitSingleSystem > 0) {
             console.log(`total amount of pages that couldn't fit a single music system: ${timesPageCouldntFitSingleSystem} of ${currentPage.PageNumber}`);
         }
+        if (this.rules.PageBottomExtraWhiteSpace > 0 && this.graphicalMusicSheet.MusicPages.length === 1) {
+            // experimental, not used unless the EngravingRule is set to > 0 (default 0)
+
+            // calculate last page's bounding box, otherwise it uses this.rules.PageHeight which is 10001
+            currentPage.PositionAndShape.calculateBoundingBox();
+            // TODO currently bugged with PageFormat A3. this squeezes lyrics and notes (with A3 Landscape). why?
+            //   for this reason, the extra white space should currently only be used with the Endless PageFormat,
+            //   and using EngravingRules.PageBottomExtraWhiteSpace should be considered experimental.
+
+            // add this.rules.PageBottomMargin
+            const pageBottomMarginBB: BoundingBox = new BoundingBox(currentPage, currentPage.PositionAndShape, false);
+            // pageBottomMarginBB.RelativePosition.x = 0;
+            pageBottomMarginBB.RelativePosition.y = currentPage.PositionAndShape.BorderMarginBottom;
+            // pageBottomMarginBB.BorderBottom = this.rules.PageBottomMargin;
+            pageBottomMarginBB.BorderBottom = this.rules.PageBottomExtraWhiteSpace;
+            pageBottomMarginBB.calculateBoundingBox();
+            currentPage.PositionAndShape.calculateBoundingBox();
+        }
+
     }
 
     /**