-
Notifications
You must be signed in to change notification settings - Fork 662
Development Gotchas
Robert Wildling edited this page Mar 31, 2020
·
15 revisions
This list is a WIP and far from complete.
-
The usage of the word
top
does not always mean the same thing. Sometimes it is relative to the stem direction, sometimes it is relative to the Canvas.- Examples
- A.
staveNote.getStemExtents()
returns atopY
which references the y value of the stem's tip, not the top-most y point of the stem (which is what most people would expect, unfortunately). ThetopY
is related to the stem direction, not the canvas. - B.
staveNote.getNoteheadBounds()
does the opposite. It returns ay_top
andy_bottom
that are relative to the canvas, not the stem direction.
- A.
- We should not have two different notions of "top" within the codebase. It should always be relative to the Canvas coordinate system.
- Examples
-
There word
line
is very overloaded, and means drastically different things in different contexts- Examples
-
staveNote.getKeyProps()
contains objects with aline
property, that represents a more semantic understanding of the staff. Where the lines are indexed in a 1-based bottom-up manner. ie, line1
is E4 in treble clef -- the bottom-most line. -
stave.getYForLine(line)
takes aline
argument which is intended to indexed in a 0-based top-down manner. Meaning that the top-most line of the staff is line0
-
stave.getYFor{Top|Bottom}Text(line)
takes aline
argument which is a directional offset from thetop_text_position
andbottom_text_position
defined instave.options
- The
modifier.text_line
/modifierContext.state.text_line
properties represent offsets from a modifier's initial position. There is not necessarily a relationship with the stave text positions. It could equally represent an offset from the stem tip or an offset from the stave'stop_text_position
-
- We would ideally have one consistent way to reference locations on a staff.
- Examples
-
The
stave
has an option calledspacing_between_lines_px
(often shorted toline_spacing
) which is non-standard name for what is typically called the "staff/stave space". -
Formatter#format
andFormatter#formatToStave
take anoptions
object with analign_rests
property. However, if set tofalse
, this will still align rests within beams.
[ VexFlow.com ] [ API ] [ GitHub Repo ] [ Contributors ]