Skip to content

Commit da4d6cb

Browse files
committed
Fix measure number collides with bracket
Follow up to #30771, now also works when measure numbers are below the staff Resolves: #30707
1 parent 8a9dd51 commit da4d6cb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/engraving/rendering/score/measurenumberlayout.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,14 @@ void MeasureNumberLayout::layoutMeasureNumberBase(MeasureNumberBase* item, Measu
122122

123123
TextLayout::layoutBaseTextBase1(item, ldata);
124124

125+
staff_idx_t effectiveStaffIdx = item->effectiveStaffIdx();
126+
Staff* staff = item->score()->staff(effectiveStaffIdx);
127+
125128
if (item->placeBelow()) {
126129
double yoff = ldata->bbox().height();
127130

128131
// If there is only one line, the barline spans outside the staff lines, so the default position is not correct.
129-
if (item->staff()->constStaffType(item->measure()->tick())->lines() == 1) {
132+
if (staff && staff->lines(item->tick()) == 1) {
130133
yoff += 2.0 * item->spatium();
131134
} else {
132135
yoff += item->staff()->staffHeight();
@@ -137,8 +140,6 @@ void MeasureNumberLayout::layoutMeasureNumberBase(MeasureNumberBase* item, Measu
137140
double yoff = 0.0;
138141

139142
// If there is only one line, the barline spans outside the staff lines, so the default position is not correct.
140-
staff_idx_t effectiveStaffIdx = item->effectiveStaffIdx();
141-
Staff* staff = item->score()->staff(effectiveStaffIdx);
142143
if (staff && staff->lines(item->tick()) == 1) {
143144
yoff -= 2.0 * item->spatium();
144145
}

0 commit comments

Comments
 (0)