diff --git a/include/vrv/elementpart.h b/include/vrv/elementpart.h index 4387902979c..3f5c98d4d2c 100644 --- a/include/vrv/elementpart.h +++ b/include/vrv/elementpart.h @@ -22,7 +22,7 @@ class TupletNum; //---------------------------------------------------------------------------- /** - * This class models a group of dots as a layer element part and has not direct MEI equivlatent. + * This class models a group of dots as a layer element part and has no direct MEI equivalent. */ class Dots : public LayerElement, public AttAugmentDots { public: @@ -92,7 +92,7 @@ class Dots : public LayerElement, public AttAugmentDots { //---------------------------------------------------------------------------- /** - * This class models a stem as a layer element part and has not direct MEI equivlatent. + * This class models a stem as a layer element part and has no direct MEI equivalent. */ class Flag : public LayerElement { public: @@ -144,7 +144,7 @@ class Flag : public LayerElement { //---------------------------------------------------------------------------- /** - * This class models a bracket as a layer element part and has not direct MEI equivlatent. + * This class models a bracket as a layer element part and has no direct MEI equivalent. * It is used to represent tuplet brackets. */ class TupletBracket : public LayerElement, public AttTupletVis { @@ -243,7 +243,7 @@ class TupletBracket : public LayerElement, public AttTupletVis { //---------------------------------------------------------------------------- /** - * This class models a tuplet num as a layer element part and has not direct MEI equivlatent. + * This class models a tuplet num as a layer element part and has no direct MEI equivalent. * It is used to represent tuplet number */ class TupletNum : public LayerElement, public AttNumberPlacement, public AttTupletVis { diff --git a/src/layerelement.cpp b/src/layerelement.cpp index 93766929238..78cae4a13e8 100644 --- a/src/layerelement.cpp +++ b/src/layerelement.cpp @@ -901,13 +901,16 @@ MapOfDotLocs LayerElement::CalcOptimalDotLocations() // Special treatment for two layers if (layerCount == 2) { - // Find the first note on the other layer + // Find the first note on the other layer, but in the same staff Alignment *alignment = this->GetAlignment(); + const Staff *currentStaff = this->GetAncestorStaff(RESOLVE_CROSS_STAFF); const int currentLayerN = abs(this->GetAlignmentLayerN()); ListOfObjects notes = alignment->FindAllDescendantsByType(NOTE, false); - auto noteIt = std::find_if(notes.cbegin(), notes.cend(), [currentLayerN](Object *obj) { - const int otherLayerN = abs(vrv_cast(obj)->GetAlignmentLayerN()); - return (currentLayerN != otherLayerN); + auto noteIt = std::find_if(notes.cbegin(), notes.cend(), [currentLayerN, currentStaff](Object *obj) { + const Note *otherNote = vrv_cast(obj); + const Staff *otherStaff = otherNote->GetAncestorStaff(RESOLVE_CROSS_STAFF); + const int otherLayerN = abs(otherNote->GetAlignmentLayerN()); + return ((currentLayerN != otherLayerN) && (currentStaff == otherStaff)); }); if (noteIt != notes.cend()) {