Skip to content

Commit

Permalink
Merge pull request #3832 from brdvd/fix/sameasBeam
Browse files Browse the repository at this point in the history
Handle stem-sameas beam notes in layer overlap
  • Loading branch information
lpugin authored Oct 17, 2024
2 parents 248cdfd + 8ed3b4a commit 2062300
Showing 1 changed file with 13 additions and 2 deletions.
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

0 comments on commit 2062300

Please sign in to comment.