Skip to content

Commit

Permalink
Update grace notes
Browse files Browse the repository at this point in the history
  • Loading branch information
miiizen committed Jan 10, 2024
1 parent 0e1ab50 commit 594a2f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/engraving/rendering/dev/measurelayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,8 @@ void MeasureLayout::layoutCrossStaff(MeasureBase* mb, LayoutContext& ctx)
return;
}

bool layoutGrace = false;

for (Segment& s : m->segments()) {
if (!s.enabled()) {
continue;
Expand All @@ -1596,6 +1598,7 @@ void MeasureLayout::layoutCrossStaff(MeasureBase* mb, LayoutContext& ctx)
// Chord has changed direction, lay out again
ChordLayout::layoutChords1(ctx, &s, c->vStaffIdx());
s.createShape(c->vStaffIdx());
layoutGrace |= !c->graceNotes().empty();
}
}
if (!c->graceNotes().empty()) {
Expand All @@ -1608,6 +1611,12 @@ void MeasureLayout::layoutCrossStaff(MeasureBase* mb, LayoutContext& ctx)
}
}
}
if (layoutGrace) {
ChordLayout::updateGraceNotes(m, ctx);
for (Segment& s : m->segments()) {
ChordLayout::repositionGraceNotesAfter(&s, ctx.dom().ntracks());
}
}
}

void MeasureLayout::barLinesSetSpan(Segment* seg, LayoutContext& ctx)
Expand Down
6 changes: 6 additions & 0 deletions src/engraving/rendering/dev/tlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2896,6 +2896,12 @@ void TLayout::layoutGraceNotesGroup(GraceNotesGroup* item, LayoutContext& ctx)

item->setPos(xPos, 0.0);

for (Chord* gn : *item) {
if (gn->beam() && gn->beam()->elements().front() == gn) {
TLayout::layoutBeam(gn->beam(), ctx);
}
}

if (isTabStaff) {
ChordLayout::layoutStem(parentChord, ctx);
}
Expand Down

0 comments on commit 594a2f6

Please sign in to comment.