|
@@ -1934,13 +1934,15 @@ export abstract class MusicSheetCalculator {
|
|
subtitle.PositionAndShape.RelativePosition = relative;
|
|
subtitle.PositionAndShape.RelativePosition = relative;
|
|
page.Labels.push(subtitle);
|
|
page.Labels.push(subtitle);
|
|
}
|
|
}
|
|
- //Get the first system, first staffline skybottomcalculator
|
|
|
|
- const topStaffline: StaffLine = page.MusicSystems[0].StaffLines[0];
|
|
|
|
- const skyBottomLineCalculator: SkyBottomLineCalculator = topStaffline.SkyBottomLineCalculator;
|
|
|
|
|
|
+ // Get the first system, first staffline skybottomcalculator
|
|
|
|
+ // const topStaffline: StaffLine = page.MusicSystems[0].StaffLines[0];
|
|
|
|
+ // const skyBottomLineCalculator: SkyBottomLineCalculator = topStaffline.SkyBottomLineCalculator;
|
|
|
|
+ // we don't need a skybottomcalculator currently, labels are put above system skyline anyways.
|
|
const composer: GraphicalLabel = this.graphicalMusicSheet.Composer;
|
|
const composer: GraphicalLabel = this.graphicalMusicSheet.Composer;
|
|
|
|
+ let composerRelativeY: number;
|
|
if (composer) {
|
|
if (composer) {
|
|
composer.PositionAndShape.Parent = page.PositionAndShape; // if using pageWidth. (which can currently be too wide) TODO fix pageWidth (#578)
|
|
composer.PositionAndShape.Parent = page.PositionAndShape; // if using pageWidth. (which can currently be too wide) TODO fix pageWidth (#578)
|
|
- //composer.PositionAndShape.Parent = firstStaffLine.PositionAndShape; if using firstStaffLine...width.
|
|
|
|
|
|
+ //composer.PositionAndShape.Parent = topStaffline.PositionAndShape; // if using firstStaffLine...width.
|
|
// y-collision problems, harder to y-align with lyrics
|
|
// y-collision problems, harder to y-align with lyrics
|
|
composer.setLabelPositionAndShapeBorders();
|
|
composer.setLabelPositionAndShapeBorders();
|
|
const relative: PointF2D = new PointF2D();
|
|
const relative: PointF2D = new PointF2D();
|
|
@@ -1952,25 +1954,30 @@ export abstract class MusicSheetCalculator {
|
|
//relative.x = firstStaffLine.PositionAndShape.Size.width;
|
|
//relative.x = firstStaffLine.PositionAndShape.Size.width;
|
|
//when this is less, goes higher.
|
|
//when this is less, goes higher.
|
|
//So 0 is top of the sheet, 22 or so is touching the music system margin
|
|
//So 0 is top of the sheet, 22 or so is touching the music system margin
|
|
|
|
+
|
|
relative.y = firstSystemAbsoluteTopMargin;
|
|
relative.y = firstSystemAbsoluteTopMargin;
|
|
//relative.y = - this.rules.SystemComposerDistance;
|
|
//relative.y = - this.rules.SystemComposerDistance;
|
|
//relative.y = -firstStaffLine.PositionAndShape.Size.height;
|
|
//relative.y = -firstStaffLine.PositionAndShape.Size.height;
|
|
// TODO only add measure label height if rendering labels and composer measure has label
|
|
// TODO only add measure label height if rendering labels and composer measure has label
|
|
// TODO y-align with lyricist? which is harder if they have different bbox parents (page and firstStaffLine).
|
|
// TODO y-align with lyricist? which is harder if they have different bbox parents (page and firstStaffLine).
|
|
// when the pageWidth gets fixed, we could use page as parent again.
|
|
// when the pageWidth gets fixed, we could use page as parent again.
|
|
- if (!composer.TextLines || composer.TextLines?.length === 1) {
|
|
|
|
- //Don't want to affect existing behavior
|
|
|
|
- relative.y -= this.rules.SystemComposerDistance;
|
|
|
|
- } else {
|
|
|
|
- //Sufficient for now to just use the longest composer entry instead of bottom.
|
|
|
|
- //Otherwise we need to construct a 'bottom line' for the text block
|
|
|
|
- const endX: number = topStaffline.PositionAndShape.BorderMarginRight;
|
|
|
|
- const startX: number = endX - composer.PositionAndShape.Size.width;
|
|
|
|
|
|
|
|
- const currentMin: number = skyBottomLineCalculator.getSkyLineMinInRange(startX, endX);
|
|
|
|
- relative.y += currentMin - composer.PositionAndShape.BorderBottom;
|
|
|
|
- skyBottomLineCalculator.updateSkyLineInRange(startX, endX, currentMin - composer.PositionAndShape.MarginSize.height);
|
|
|
|
|
|
+ //Sufficient for now to just use the longest composer entry instead of bottom.
|
|
|
|
+ //Otherwise we need to construct a 'bottom line' for the text block
|
|
|
|
+ // const endX: number = topStaffline.PositionAndShape.BorderMarginRight;
|
|
|
|
+ // const startX: number = endX - composer.PositionAndShape.Size.width;
|
|
|
|
+ // const currentMin: number = skyBottomLineCalculator.getSkyLineMinInRange(startX, endX);
|
|
|
|
+
|
|
|
|
+ relative.y -= this.rules.SystemComposerDistance;
|
|
|
|
+ const lines: number = composer.TextLines?.length;
|
|
|
|
+ if (lines > 1) { //Don't want to affect existing behavior. but this doesn't check bboxes for clip
|
|
|
|
+ relative.y -= composer.PositionAndShape.BorderBottom * (lines - 1) / (lines);
|
|
}
|
|
}
|
|
|
|
+ //const newSkylineY: number = currentMin; // don't add composer label height to skyline
|
|
|
|
+ //- firstSystemAbsoluteTopMargin - this.rules.SystemComposerDistance - composer.PositionAndShape.MarginSize.height;
|
|
|
|
+ //skyBottomLineCalculator.updateSkyLineInRange(startX, endX, newSkylineY); // this can fix skyline for generateImages for some reason
|
|
|
|
+ composerRelativeY = relative.y; // for lyricist label
|
|
|
|
+
|
|
composer.PositionAndShape.RelativePosition = relative;
|
|
composer.PositionAndShape.RelativePosition = relative;
|
|
page.Labels.push(composer);
|
|
page.Labels.push(composer);
|
|
}
|
|
}
|
|
@@ -1981,16 +1988,13 @@ export abstract class MusicSheetCalculator {
|
|
const relative: PointF2D = new PointF2D();
|
|
const relative: PointF2D = new PointF2D();
|
|
relative.x = this.rules.PageLeftMargin;
|
|
relative.x = this.rules.PageLeftMargin;
|
|
relative.y = firstSystemAbsoluteTopMargin;
|
|
relative.y = firstSystemAbsoluteTopMargin;
|
|
- if (!lyricist.TextLines || lyricist.TextLines?.length === 1) {
|
|
|
|
- relative.y -= this.rules.SystemComposerDistance;
|
|
|
|
- } else {
|
|
|
|
- const startX: number = topStaffline.PositionAndShape.BorderMarginLeft - relative.x;
|
|
|
|
- const endX: number = startX + lyricist.PositionAndShape.Size.width;
|
|
|
|
|
|
+ // const startX: number = topStaffline.PositionAndShape.BorderMarginLeft - relative.x;
|
|
|
|
+ // const endX: number = startX + lyricist.PositionAndShape.Size.width;
|
|
|
|
+ // const currentMin: number = skyBottomLineCalculator.getSkyLineMinInRange(startX, endX);
|
|
|
|
|
|
- const currentMin: number = skyBottomLineCalculator.getSkyLineMinInRange(startX, endX);
|
|
|
|
- relative.y += currentMin - lyricist.PositionAndShape.BorderBottom;
|
|
|
|
- skyBottomLineCalculator.updateSkyLineInRange(startX, endX, currentMin - lyricist.PositionAndShape.MarginSize.height);
|
|
|
|
- }
|
|
|
|
|
|
+ relative.y += lyricist.PositionAndShape.BorderBottom;
|
|
|
|
+ relative.y = Math.min(relative.y, composerRelativeY); // same height as composer label (at least not lower)
|
|
|
|
+ //skyBottomLineCalculator.updateSkyLineInRange(startX, endX, currentMin - lyricist.PositionAndShape.MarginSize.height);
|
|
//relative.y = Math.max(relative.y, composer.PositionAndShape.RelativePosition.y);
|
|
//relative.y = Math.max(relative.y, composer.PositionAndShape.RelativePosition.y);
|
|
lyricist.PositionAndShape.RelativePosition = relative;
|
|
lyricist.PositionAndShape.RelativePosition = relative;
|
|
page.Labels.push(lyricist);
|
|
page.Labels.push(lyricist);
|