Skip to content

Commit c19ff2b

Browse files
committed
Simplify baseline alignment of Harmonies
1 parent f01873d commit c19ff2b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/engraving/rendering/score/tlayout.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,7 @@ void TLayout::layoutFBox(const FBox* item, FBox::LayoutData* ldata, const Layout
15471547
double height = fretRect.united(harmonyRect).height();
15481548
maxRowHeight = std::max(maxRowHeight, height);
15491549
maxHarmonyHeight = std::max(maxHarmonyHeight, -harmonyRect.top());
1550-
harmonyBaseline = std::max(harmonyBaseline, fretDiagram->harmony()->baseLine());
1550+
harmonyBaseline = std::min(harmonyBaseline, harmonyLdata->pos().y());
15511551
}
15521552

15531553
rowHeights.push_back(maxRowHeight);
@@ -1596,12 +1596,10 @@ void TLayout::layoutFBox(const FBox* item, FBox::LayoutData* ldata, const Layout
15961596
y += rowHeights[r] + rowGap;
15971597
}
15981598

1599-
std::vector<HarmonyRenderItem*> renderItemList = harmony->ldata()->renderItemList.value();
1600-
double baseline = renderItemList.empty() ? 0.0 : renderItemList.front()->bboxBaseLine() + renderItemList.front()->pos().y();
1601-
1602-
double baseLineAdjust = harmony->ldata()->bbox().bottom() - baseline;
1603-
1604-
harmony->mutldata()->moveY(-(harmonyBaselines[row]) + baseLineAdjust);
1599+
double commonBaseline = harmonyBaselines[row];
1600+
double thisBaseline = harmony->ldata()->pos().y();
1601+
double baselineOff = commonBaseline - thisBaseline;
1602+
harmony->mutldata()->moveY(baselineOff);
16051603

16061604
double fretDiagramX = x;
16071605
double fretDiagramY = y + harmonyHeights[row];

0 commit comments

Comments
 (0)