Skip to content

Commit

Permalink
Fix ornament delayed draw, such as on a grand staff.
Browse files Browse the repository at this point in the history
  • Loading branch information
RyoSusami committed Oct 3, 2023
1 parent e5f7786 commit 7ca0866
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ornament.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,12 @@ export class Ornament extends Modifier {
delayXShift = this.delayXShift;
} else {
delayXShift += this.glyph.getMetrics().width / 2;
const nextContext = TickContext.getNextContext(note.getTickContext());
if (nextContext) {
const context = note.getTickContext();
const nextContext = TickContext.getNextContext(context);
if (nextContext && context.getTickID() < nextContext.getTickID()) {
delayXShift += (nextContext.getX() - startX) * 0.5;
} else {
delayXShift += (stave.getX() + stave.getWidth() - startX) * 0.5;
delayXShift += (stave.getX() + stave.getWidth() - glyphX) * 0.5;
}
this.delayXShift = delayXShift;
}
Expand Down

0 comments on commit 7ca0866

Please sign in to comment.