vexflow icon indicating copy to clipboard operation
vexflow copied to clipboard

How do I know the note's x-position before it drawed?

Open G-Spurs opened this issue 7 years ago • 1 comments

For example,in the Tutorial (https://jsfiddle.net/8eckj32x/512/); I added two output statements before and after this sentence(voice.draw(context, stave);). like this: console.log(notes[0].getAbsoluteX()); voice.draw(context, stave); console.log(notes[0].getAbsoluteX());

The results are different.As one is 0,one is 79.9007.... Why is it?And I want know the notes's position before drawing.What should I do?

G-Spurs avatar Apr 03 '18 06:04 G-Spurs

I think one way is specify stave on format:

var formatter = new VF.Formatter().joinVoices([voice]).format([voice], 400, {stave: stave});

https://jsfiddle.net/8eckj32x/560/

sug1no avatar Apr 04 '18 02:04 sug1no