Skip to content

Commit

Permalink
Merge pull request #19831 from miiizen/19669-cross-beam-collision
Browse files Browse the repository at this point in the history
Enable 2nd adjustment for cross staff beamed notes
  • Loading branch information
cbjeukendrup committed Oct 27, 2023
2 parents a34bccf + 7e06518 commit 27faf62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/engraving/rendering/dev/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,6 @@ void ChordLayout::layoutChords1(LayoutContext& ctx, Segment* segment, staff_idx_
return;
}

bool crossBeamFound = false;
std::vector<Chord*> chords;
std::vector<Note*> upStemNotes;
std::vector<Note*> downStemNotes;
Expand All @@ -1459,9 +1458,6 @@ void ChordLayout::layoutChords1(LayoutContext& ctx, Segment* segment, staff_idx_
if (e && e->isChord() && toChord(e)->vStaffIdx() == staffIdx) {
Chord* chord = toChord(e);
chords.push_back(chord);
if (chord->beam() && chord->beam()->cross()) {
crossBeamFound = true;
}
bool hasGraceBefore = false;
for (Chord* c : chord->graceNotes()) {
if (c->isGraceBefore()) {
Expand All @@ -1475,7 +1471,7 @@ void ChordLayout::layoutChords1(LayoutContext& ctx, Segment* segment, staff_idx_
upStemNotes.insert(upStemNotes.end(), chord->notes().begin(), chord->notes().end());
upDots = std::max(upDots, chord->dots());
maxUpMag = std::max(maxUpMag, chord->mag());
if (!upHooks) {
if (!upHooks && !chord->beam()) {
upHooks = chord->hook();
}
if (hasGraceBefore) {
Expand All @@ -1486,7 +1482,7 @@ void ChordLayout::layoutChords1(LayoutContext& ctx, Segment* segment, staff_idx_
downStemNotes.insert(downStemNotes.end(), chord->notes().begin(), chord->notes().end());
downDots = std::max(downDots, chord->dots());
maxDownMag = std::max(maxDownMag, chord->mag());
if (!downHooks) {
if (!downHooks && !chord->beam()) {
downHooks = chord->hook();
}
if (hasGraceBefore) {
Expand Down Expand Up @@ -1594,14 +1590,8 @@ void ChordLayout::layoutChords1(LayoutContext& ctx, Segment* segment, staff_idx_
if (upVoices && downVoices) {
Note* bottomUpNote = upStemNotes.front();
Note* topDownNote = downStemNotes.back();
int separation;
// TODO: handle conflicts for notes on cross-staff beams
// for now we simply treat these as though there is no conflict
if (!crossBeamFound) {
separation = topDownNote->line() - bottomUpNote->line();
} else {
separation = 2; // no conflict
}
int separation = topDownNote->line() - bottomUpNote->line();

std::vector<Note*> overlapNotes;
overlapNotes.reserve(8);

Expand Down
Binary file added vtest/scores/cross-8.mscz
Binary file not shown.

0 comments on commit 27faf62

Please sign in to comment.