Skip to content

Commit

Permalink
Merge pull request #133 from DDMAL/group-fix
Browse files Browse the repository at this point in the history
Use while loop for consecutive layer elements inside syllable
  • Loading branch information
yinanazhou authored Mar 14, 2024
2 parents 944f191 + f81a769 commit 4eddf05
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/editortoolkit_neume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2836,6 +2836,7 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector<std::string>
ListOfObjects syllables; // List of syllables used. groupType=neume only.

jsonxx::Array uuidArray;
bool breakOnEnd = false;

// Check if you can get drawing page
if (!m_doc->GetDrawingPage()) {
Expand Down Expand Up @@ -2910,7 +2911,7 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector<std::string>
}
}
}
if (el->Is(ACCID) || el->Is(DIVLINE) || el->Is(CLEF)) {
while (el->Is(ACCID) || el->Is(DIVLINE) || el->Is(CLEF)) {
fparent = el->GetFirstAncestor(SYLLABLE);
sparent = el->GetFirstAncestor(LAYER);
if (fparent && sparent) {
Expand All @@ -2920,10 +2921,15 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector<std::string>
fparent->ReorderByXPos();
uuidArray << (*it);
it = elementIds.erase(it);
if (it == elementIds.end()) break;
if (it == elementIds.end()) {
breakOnEnd = true;
break;
}
el = m_doc->GetDrawingPage()->FindDescendantByID(*it);
}
}
if (breakOnEnd) break;

if (elementIds.begin() == it || firstIsSyl) {
// if the element is a syl we want it to stay attached to the first element
// we'll still need to initialize all the parents, thus the bool
Expand Down

0 comments on commit 4eddf05

Please sign in to comment.