From 7ca086668f1c75538afad3faff8c8481384ca132 Mon Sep 17 00:00:00 2001 From: Ryo Susami <36094352+RyoSusami@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:19:12 +0900 Subject: [PATCH] Fix ornament delayed draw, such as on a grand staff. --- src/ornament.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ornament.ts b/src/ornament.ts index 045563ce26..d359900a6f 100644 --- a/src/ornament.ts +++ b/src/ornament.ts @@ -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; }