Skip to content

Commit

Permalink
Merge pull request musescore#13333 from mike-spa/oneDottedCorrection
Browse files Browse the repository at this point in the history
Multiple voices overlaps with one dotted correction
  • Loading branch information
cbjeukendrup authored Sep 14, 2022
2 parents f92a0d5 + 6dba9c8 commit af7f69f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/engraving/layout/layoutchords.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,16 @@ void LayoutChords::layoutChords1(Score* score, Segment* segment, staff_idx_t sta

if (separation == 1) {
// second
downOffset = maxUpWidth;
// align stems if present, leave extra room if not
if (topDownNote->chord()->stem() && bottomUpNote->chord()->stem()) {
downOffset -= topDownNote->chord()->stem()->lineWidth();
if (upDots && !downDots) {
upOffset = maxDownWidth + 0.1 * sp;
} else {
downOffset += 0.1 * sp;
downOffset = maxUpWidth;
// align stems if present, leave extra room if not
if (topDownNote->chord()->stem() && bottomUpNote->chord()->stem()) {
downOffset -= topDownNote->chord()->stem()->lineWidth();
} else {
downOffset += 0.1 * sp;
}
}
} else if (separation < 1) {
// overlap (possibly unison)
Expand Down Expand Up @@ -363,6 +367,7 @@ void LayoutChords::layoutChords1(Score* score, Segment* segment, staff_idx_t sta
shareHeads = false;
}

bool conflict = conflictUnison || conflictSecondDownHigher || conflictSecondUpHigher;
// calculate offsets
if (shareHeads) {
for (int i = static_cast<int>(overlapNotes.size()) - 1; i >= 1; i -= 2) {
Expand Down Expand Up @@ -393,6 +398,8 @@ void LayoutChords::layoutChords1(Score* score, Segment* segment, staff_idx_t sta
// so better to solve the problem elsewhere
}
}
} else if (conflict && (upDots && !downDots)) {
upOffset = maxDownWidth + 0.1 * sp;
} else if (conflictUnison && separation == 0 && (!downGrace || upGrace)) {
downOffset = maxUpWidth + 0.3 * sp;
} else if (conflictUnison) {
Expand Down
Binary file added vtest/scores/chord-layout-19.mscz
Binary file not shown.

0 comments on commit af7f69f

Please sign in to comment.