From 8ed3b4ad67aae1f2f3439c528425faee202fbcd0 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 17 Oct 2024 11:18:59 +0200 Subject: [PATCH] Ignore stem-sameas notes in beam for layer overlap --- src/layerelement.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/layerelement.cpp b/src/layerelement.cpp index 2422f9b41e..dbf3b45ba8 100644 --- a/src/layerelement.cpp +++ b/src/layerelement.cpp @@ -984,9 +984,20 @@ int LayerElement::CalcLayerOverlap(const Doc *doc, int direction, int y1, int y2 { Layer *parentLayer = vrv_cast(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(this); + const Beam *stemSameAsBeam = beam->GetStemSameasBeam(); + if (stemSameAsBeam) { + collidingElementsList.remove_if([stemSameAsBeam](Object *object) { + const LayerElement *layerElement = vrv_cast(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();