Skip to content

Commit

Permalink
Merge pull request #3745 from brdvd/fix/dots-on-unisons
Browse files Browse the repository at this point in the history
Fix dots on unisons
  • Loading branch information
lpugin authored Aug 26, 2024
2 parents 57818ed + 58ce9e8 commit 32ab461
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/vrv/elementpart.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
11 changes: 7 additions & 4 deletions src/layerelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Note *>(obj)->GetAlignmentLayerN());
return (currentLayerN != otherLayerN);
auto noteIt = std::find_if(notes.cbegin(), notes.cend(), [currentLayerN, currentStaff](Object *obj) {
const Note *otherNote = vrv_cast<Note *>(obj);
const Staff *otherStaff = otherNote->GetAncestorStaff(RESOLVE_CROSS_STAFF);
const int otherLayerN = abs(otherNote->GetAlignmentLayerN());
return ((currentLayerN != otherLayerN) && (currentStaff == otherStaff));
});

if (noteIt != notes.cend()) {
Expand Down

0 comments on commit 32ab461

Please sign in to comment.