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

Fix GH#19669: Enable 2nd adjustment for cross staff beamed notes #219

Draft
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Draft
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
16 changes: 4 additions & 12 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ void Score::layoutChords1(Segment* segment, int staffIdx)
return;
}

bool crossBeamFound = false;
std::vector<Note*> upStemNotes;
std::vector<Note*> downStemNotes;
int upVoices = 0;
Expand All @@ -176,8 +175,6 @@ void Score::layoutChords1(Segment* segment, int staffIdx)
Element* e = segment->element(track);
if (e && e->isChord()) {
Chord* chord = toChord(e);
if (chord->beam() && chord->beam()->cross())
crossBeamFound = true;
bool hasGraceBefore = false;
for (Chord* c : qAsConst(chord->graceNotes())) {
if (c->isGraceBefore())
Expand All @@ -190,7 +187,7 @@ void Score::layoutChords1(Segment* segment, int staffIdx)
upStemNotes.insert(upStemNotes.end(), chord->notes().begin(), chord->notes().end());
upDots = qMax(upDots, chord->dots());
maxUpMag = qMax(maxUpMag, chord->mag());
if (!upHooks)
if (!upHooks && !chord->beam())
upHooks = chord->hook();
if (hasGraceBefore)
upGrace = true;
Expand All @@ -200,7 +197,7 @@ void Score::layoutChords1(Segment* segment, int staffIdx)
downStemNotes.insert(downStemNotes.end(), chord->notes().begin(), chord->notes().end());
downDots = qMax(downDots, chord->dots());
maxDownMag = qMax(maxDownMag, chord->mag());
if (!downHooks)
if (!downHooks && !chord->beam())
downHooks = chord->hook();
if (hasGraceBefore)
downGrace = true;
Expand Down Expand Up @@ -308,13 +305,8 @@ void Score::layoutChords1(Segment* segment, int staffIdx)
if (upVoices && downVoices) {
Note* bottomUpNote = upStemNotes.front();
Note* topDownNote = downStemNotes.back();
int separation;
// TODO: handle conflicts for cross-staff notes and notes on cross-staff beams
// for now we simply treat these as though there is no conflict
if (bottomUpNote->chord()->staffMove() == topDownNote->chord()->staffMove() && !crossBeamFound)
separation = topDownNote->line() - bottomUpNote->line();
else
separation = 2; // no conflict
int separation = topDownNote->line() - bottomUpNote->line();

QVector<Note*> overlapNotes;
overlapNotes.reserve(8);

Expand Down
Binary file added vtest/cross-8-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading