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

Handle stem-sameas beam notes in layer overlap #3832

Merged
merged 1 commit into from
Oct 17, 2024
Merged
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
15 changes: 13 additions & 2 deletions src/layerelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,9 +984,20 @@ int LayerElement::CalcLayerOverlap(const Doc *doc, int direction, int y1, int y2
{
Layer *parentLayer = vrv_cast<Layer *>(this->GetFirstAncestor(LAYER));
if (!parentLayer) return 0;
// Check whether there are elements on other layer in the duration of the current beam. If there are none - stop
// here, there's nothing to be done
// Check whether there are elements on the other layer in the duration of the current beam
ListOfObjects collidingElementsList = parentLayer->GetLayerElementsForTimeSpanOf(this, true);
// Ignore any elements part of a stem-sameas beam
if (this->Is(BEAM)) {
const Beam *beam = vrv_cast<Beam *>(this);
const Beam *stemSameAsBeam = beam->GetStemSameasBeam();
if (stemSameAsBeam) {
collidingElementsList.remove_if([stemSameAsBeam](Object *object) {
const LayerElement *layerElement = vrv_cast<LayerElement *>(object);
return (layerElement->GetAncestorBeam() == stemSameAsBeam);
});
}
}
// If there are none - stop here, there's nothing to be done
if (collidingElementsList.empty()) return 0;

Staff *staff = this->GetAncestorStaff();
Expand Down