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

Alignment corrections with accidentals of different sizes #26457

Merged
merged 3 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/engraving/rendering/score/accidentalslayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,8 @@ void AccidentalsLayout::collectVerticalSets(
double x1 = xPosRelativeToSegment(acc1);
for (size_t j = i + 1; j < ctx.allAccidentals.size(); ++j) {
Accidental* acc2 = ctx.allAccidentals[j];
if (acc2->accidentalType() != acc1->accidentalType() || muse::contains(accidentalsAlreadyGrouped, acc2)) {
if (acc2->accidentalType() != acc1->accidentalType() || muse::contains(accidentalsAlreadyGrouped, acc2)
|| !muse::RealIsEqual(acc1->mag(), acc2->mag())) {
continue;
}
int column2 = acc2->ldata()->column;
Expand All @@ -1057,10 +1058,12 @@ void AccidentalsLayout::alignVerticalSets(AccidentalGroups& vertSets, Accidental
// Align the set
double x = DBL_MAX;
for (Accidental* acc : vertSet) {
x = std::min(x, xPosRelativeToSegment(acc));
double rightEdge = acc->ldata()->bbox().right() + xPosRelativeToSegment(acc);
x = std::min(x, rightEdge);
}
for (Accidental* acc : vertSet) {
setXposRelativeToSegment(acc, x);
double bboxRight = acc->ldata()->bbox().right();
setXposRelativeToSegment(acc, x - bboxRight);
}

// Re-check the outer ones for collisions
Expand Down
Binary file added vtest/scores/accidental-38.mscz
Binary file not shown.
Binary file added vtest/scores/accidental-39.mscz
Binary file not shown.
Loading