Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid overlapping brackets #15514

Merged
merged 1 commit into from Mar 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/engraving/libmscore/edit.cpp
Expand Up @@ -6160,6 +6160,17 @@ void Score::undoChangeTpc(Note* note, int v)

void Score::undoAddBracket(Staff* staff, int level, BracketType type, size_t span)
{
staff_idx_t startStaffIdx = staff->idx();
staff_idx_t totStaves = nstaves();
// Make sure this brackets won't overlap with others sharing same column.
// If overlaps are found, move the other brackets outwards (i.e. increase column).
for (staff_idx_t staffIdx = startStaffIdx; staffIdx < startStaffIdx + span && staffIdx < totStaves; ++staffIdx) {
for (BracketItem* bracketItem : _staves.at(staffIdx)->brackets()) {
if (bracketItem->column() >= level) {
bracketItem->setColumn(bracketItem->column() + 1);
}
}
}
undo(new AddBracket(staff, level, type, span));
}

Expand Down