Skip to content

Commit 42c75b5

Browse files
njvdbergvpereverzev
authored andcommitted
Solve issue of fixed spacer between last staff and bottom of page.
A negative value for a fixed spacer on the last staff will no longer push the last staff below the Music Bottom Margin.
1 parent 1fd64f6 commit 42c75b5

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

libmscore/layout.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,6 +1574,7 @@ static void distributeStaves(Page* page)
15741574
int ngaps { 0 };
15751575
qreal prevYBottom { page->tm() };
15761576
qreal yBottom { 0.0 };
1577+
qreal spacerOffset { 0.0 };
15771578
bool vbox { false };
15781579
Spacer* nextSpacer { nullptr };
15791580
bool transferNormalBracket { false };
@@ -1640,8 +1641,9 @@ static void distributeStaves(Page* page)
16401641
vbox = false;
16411642
}
16421643

1643-
prevYBottom = system->y() + sysStaff->y() + sysStaff->bbox().height();
1644-
yBottom = system->y() + sysStaff->y() + sysStaff->yBottom();
1644+
prevYBottom = system->y() + sysStaff->y() + sysStaff->bbox().height();
1645+
yBottom = system->y() + sysStaff->y() + sysStaff->skyline().south().max();
1646+
spacerOffset = sysStaff->skyline().south().max() - sysStaff->bbox().height();
16451647
vgdl.append(vgd);
16461648
}
16471649
transferNormalBracket = endNormalBracket >= 0;
@@ -1651,8 +1653,8 @@ static void distributeStaves(Page* page)
16511653
--ngaps;
16521654

16531655
qreal spaceLeft { page->height() - page->bm() - score->styleP(Sid::staffLowerBorder) - yBottom };
1654-
if (nextSpacer && (nextSpacer->spacerType() == SpacerType::DOWN))
1655-
spaceLeft -= nextSpacer->gap();
1656+
if (nextSpacer)
1657+
spaceLeft -= qMax(0.0, nextSpacer->gap() - spacerOffset - score->styleP(Sid::staffLowerBorder));
16561658
if (spaceLeft <= 0.0)
16571659
return;
16581660

libmscore/measure.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,11 @@ Element* Measure::drop(EditData& data)
16121612
if (ts == s)
16131613
ns = ts;
16141614
}
1615-
if (ns && ns->page() == s->page()) {
1615+
if (ns == s) {
1616+
qreal y1 = s->staffYpage(staffIdx);
1617+
qreal y2 = s->page()->height() - s->page()->bm();
1618+
gap = y2 - y1 - score()->staff(staffIdx)->height();
1619+
} else if (ns && ns->page() == s->page()) {
16161620
qreal y1 = s->staffYpage(staffIdx);
16171621
qreal y2 = ns->staffYpage(0);
16181622
gap = y2 - y1 - score()->staff(staffIdx)->height();

0 commit comments

Comments
 (0)