File tree Expand file tree Collapse file tree 4 files changed +28
-5
lines changed Expand file tree Collapse file tree 4 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,9 @@ export abstract class Element {
64
64
return Category . Element ;
65
65
}
66
66
67
+ // all Element objects keep a list of children that they are responsible and which
68
+ // inherit the style of their parents.
69
+ // Currently used by StaveNote for noteheads and
67
70
protected children : Element [ ] = [ ] ;
68
71
protected static ID : number = 1000 ;
69
72
protected static newID ( ) : string {
@@ -108,6 +111,15 @@ export abstract class Element {
108
111
Registry . getDefaultRegistry ( ) ?. register ( this ) ;
109
112
}
110
113
114
+ /**
115
+ * Adds a child Element to the Element, which lets it inherit the
116
+ * same style as the parent when setGroupStyle() is called.
117
+ *
118
+ * Examples of children are noteheads and stems. Modifiers such
119
+ * as Accidentals are generally not set as children.
120
+ *
121
+ * Note that StaveNote calls setGroupStyle() when setStyle() is called.
122
+ */
111
123
addChildElement ( child : Element ) : this {
112
124
this . children . push ( child ) ;
113
125
return this ;
@@ -186,7 +198,7 @@ export abstract class Element {
186
198
187
199
/**
188
200
* Draw the element and all its sub-elements (ie.: Modifiers in a Stave)
189
- * with the element style.
201
+ * with the element's style (see `getStyle()` and `setStyle()`)
190
202
*/
191
203
drawWithStyle ( ) : void {
192
204
this . checkContext ( ) ;
Original file line number Diff line number Diff line change 1
1
// [VexFlow](https://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
2
+ //
3
+ // Any glyph that is set to appear on a Stave and take up musical time and graphical space.
2
4
3
5
import { BoundingBox } from './boundingbox' ;
4
6
import { Glyph } from './glyph' ;
Original file line number Diff line number Diff line change 3
3
// ## Description
4
4
//
5
5
// This class implements various types of members to notes (e.g. bends,
6
- // fingering positions etc.)
6
+ // fingering positions etc.). The ModifierContext works with tickables
7
+ // that are at the same tick to ensure that they and their modifiers
8
+ // all have proper alignment. (Note that the ModifierContext also
9
+ // runs the spacing of the tickable).
10
+ //
11
+ // see https://github.com/0xfe/vexflow/wiki/How-Formatting-Works
7
12
8
13
import { Accidental } from './accidental' ;
9
14
import { Annotation } from './annotation' ;
@@ -58,7 +63,8 @@ export class ModifierContext {
58
63
top_text_line : 0 ,
59
64
} ;
60
65
61
- // Current members
66
+ // Current members -- a mapping of Category (string) to a list of Tickables, Modifiers,
67
+ // StaveNotes, TabNotes, etc.
62
68
protected members : Record < string , ModifierContextMember [ ] > = { } ;
63
69
64
70
protected preFormatted : boolean = false ;
@@ -102,6 +108,9 @@ export class ModifierContext {
102
108
return this . members [ category ] ?? [ ] ;
103
109
}
104
110
111
+ /**
112
+ * Get the width of the entire
113
+ */
105
114
getWidth ( ) : number {
106
115
return this . width ;
107
116
}
Original file line number Diff line number Diff line change @@ -205,13 +205,13 @@ export abstract class Tickable extends Element {
205
205
return this . tuplet ;
206
206
}
207
207
208
- /** Return the intrinsic ticks . */
208
+ /** Return a list of Tuplets . */
209
209
getTupletStack ( ) : Tuplet [ ] {
210
210
return this . tupletStack ;
211
211
}
212
212
213
213
/**
214
- * Reset the specific Tuplet if this is not provided, all tuplets are reset.
214
+ * Reset the specific Tuplet ( if this is not provided, all tuplets are reset) .
215
215
* Remove any prior tuplets from the tick calculation and
216
216
* reset the intrinsic tick value.
217
217
*/
You can’t perform that action at this time.
0 commit comments