Skip to content

Commit

Permalink
single line: fix SVG width and scroll bar too large (32767/32787) whe…
Browse files Browse the repository at this point in the history
…n title not rendered (release not affected)

this regression got introduced a few commits ago
  • Loading branch information
sschmidTU committed Apr 11, 2024
1 parent 7c5a0ff commit 952eb4f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/MusicalScore/Graphical/MusicSheetCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2373,9 +2373,11 @@ export abstract class MusicSheetCalculator {
protected calculatePageLabels(page: GraphicalMusicPage): void {
// The PositionAndShape child elements of page need to be manually connected to the lyricist, composer, subtitle, etc.
// because the page is only available now
if (this.rules.RenderSingleHorizontalStaffline && this.rules.RenderTitle) {

// fix SVG width and sheet width for single line scores being 32767 or 32787
if (this.rules.RenderSingleHorizontalStaffline) {
//page.PositionAndShape.BorderRight = page.PositionAndShape.Size.width + this.rules.PageRightMargin;
page.PositionAndShape.calculateBoundingBox([GraphicalMeasure.name]); // ignore measures
page.PositionAndShape.calculateBoundingBox([GraphicalMeasure.name]); // ignore measures, whose bounding boxes somehow get messed up otherwise
// note: "GraphicalMeasure" instead of GraphicalMeasure.name doesn't work with minified builds (they change class names)
// note: calculateBoundingBox by default changes measure.PositionAndShape.Size.width for some reason,
// inaccurate for RenderSingleHorizontalStaffline, e.g. the cursor type 3 that highlights the whole measure will get wrong width
Expand Down Expand Up @@ -2508,9 +2510,10 @@ export abstract class MusicSheetCalculator {
page.Labels.push(copyright);
}
// we need to do this again to not cut off the title for short scores:
if (this.rules.RenderSingleHorizontalStaffline && this.rules.RenderTitle) {
// (and fix SVG width and sheet width for single line scores being 32767 or 32787)
if (this.rules.RenderSingleHorizontalStaffline) {
//page.PositionAndShape.BorderRight = page.PositionAndShape.Size.width + this.rules.PageRightMargin;
page.PositionAndShape.calculateBoundingBox([GraphicalMeasure.name]); // ignore measures
page.PositionAndShape.calculateBoundingBox([GraphicalMeasure.name]); // ignore measures, whose bounding boxes somehow get messed up otherwise
// note: calculateBoundingBox by default changes measure.PositionAndShape.Size.width for some reason,
// inaccurate for RenderSingleHorizontalStaffline, e.g. the cursor type 3 that highlights the whole measure will get wrong width
// correct width was set previously via MusicSystemBuilder.setMeasureWidth().
Expand Down

0 comments on commit 952eb4f

Please sign in to comment.