Skip to content

Commit

Permalink
Fix ornament delayed draw, improved selection of nextContext.
Browse files Browse the repository at this point in the history
  • Loading branch information
RyoSusami committed Oct 5, 2023
1 parent ef9e8b5 commit b184399
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,9 +308,10 @@ export class Ornament extends Modifier {
delayXShift = this.delayXShift;
} else {
delayXShift += this.glyph.getMetrics().width / 2;
const context = note.getTickContext();
const nextContext = TickContext.getNextContext(context);
if (nextContext && context.getTickID() < nextContext.getTickID()) {
const tickables = note.getVoice().getTickables();
const index = tickables.indexOf(note);
const nextContext = index + 1 < tickables.length ? tickables[index + 1].checkTickContext() : undefined;
if (nextContext) {
delayXShift += (nextContext.getX() - startX) * 0.5;
} else {
delayXShift += (stave.getX() + stave.getWidth() - glyphX) * 0.5;
Expand Down

0 comments on commit b184399

Please sign in to comment.