-
Notifications
You must be signed in to change notification settings - Fork 680
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
topdoes 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 atopYwhich 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). ThetopYis related to the stem direction, not the canvas. - B.
staveNote.getNoteheadBounds()does the opposite. It returns ay_topandy_bottomthat 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
lineis very overloaded, and means drastically different things in different contexts- Examples
-
staveNote.getKeyProps()contains objects with alineproperty, that represents a more semantic understanding of the staff. Where the lines are indexed in a 1-based bottom-up manner. ie, line1is E4 in treble clef -- the bottom-most line. -
stave.getYForLine(line)takes alineargument 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 alineargument which is a directional offset from thetop_text_positionandbottom_text_positiondefined instave.options - The
modifier.text_line/modifierContext.state.text_lineproperties 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
stavehas 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#formatandFormatter#formatToStavetake anoptionsobject with analign_restsproperty. However, if set tofalse, this will still align rests within beams.
[ VexFlow.com ] [ API ] [ GitHub Repo ] [ Contributors ]