Skip to content

Commit

Permalink
Ported similar to 0xfe/vexflow#1598.
Browse files Browse the repository at this point in the history
  • Loading branch information
RyoSusami committed Oct 6, 2023
1 parent ec1b6f9 commit 106bdac
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 @@ -10,7 +10,6 @@ import { ModifierContextState } from './modifiercontext';
import { Note } from './note';
import { StemmableNote } from './stemmablenote';
import { Tables } from './tables';
import { TickContext } from './tickcontext';
import { Category } from './typeguard';
import { log } from './util';

Expand Down Expand Up @@ -243,11 +242,13 @@ export class Ornament extends Modifier {
if (this.delayXShift !== undefined) {
delayXShift = this.delayXShift;
} else {
const nextContext = TickContext.getNextContext(note.getTickContext());
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() - startX) * 0.5;
delayXShift += (stave.getX() + stave.getWidth() - glyphX) * 0.5;
}
this.delayXShift = delayXShift;
}
Expand Down

0 comments on commit 106bdac

Please sign in to comment.