vexflow 5.0.0-alpha.4 → 5.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/build/cjs/vexflow-bravura.js +2 -2
- package/build/cjs/vexflow-bravura.js.map +1 -1
- package/build/cjs/vexflow-core.js +2 -2
- package/build/cjs/vexflow-core.js.map +1 -1
- package/build/cjs/vexflow-debug-with-tests.js +1546 -1393
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +600 -549
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/annotation.js +0 -2
- package/build/esm/src/barnote.js +3 -3
- package/build/esm/src/beam.js +2 -4
- package/build/esm/src/bend.js +11 -3
- package/build/esm/src/chordsymbol.js +0 -4
- package/build/esm/src/clef.js +0 -2
- package/build/esm/src/curve.js +8 -5
- package/build/esm/src/element.js +11 -17
- package/build/esm/src/factory.js +4 -4
- package/build/esm/src/flag.js +20 -0
- package/build/esm/src/formatter.js +4 -4
- package/build/esm/src/glyphnote.js +0 -2
- package/build/esm/src/gracenote.js +0 -2
- package/build/esm/src/gracenotegroup.js +17 -8
- package/build/esm/src/index.js +1 -0
- package/build/esm/src/keysignature.js +38 -31
- package/build/esm/src/keysignote.js +1 -1
- package/build/esm/src/metrics.js +55 -7
- package/build/esm/src/modifier.js +4 -2
- package/build/esm/src/notehead.js +6 -1
- package/build/esm/src/ornament.js +0 -2
- package/build/esm/src/pedalmarking.js +33 -41
- package/build/esm/src/stave.js +10 -16
- package/build/esm/src/stavebarline.js +2 -3
- package/build/esm/src/stavehairpin.js +1 -1
- package/build/esm/src/staveline.js +0 -4
- package/build/esm/src/stavemodifier.js +0 -2
- package/build/esm/src/stavenote.js +16 -28
- package/build/esm/src/staverepetition.js +3 -2
- package/build/esm/src/stavesection.js +13 -15
- package/build/esm/src/stavetempo.js +3 -2
- package/build/esm/src/stavetext.js +2 -2
- package/build/esm/src/stavetie.js +0 -4
- package/build/esm/src/stavevolta.js +3 -2
- package/build/esm/src/stem.js +0 -4
- package/build/esm/src/stemmablenote.js +5 -6
- package/build/esm/src/stringnumber.js +0 -2
- package/build/esm/src/svgcontext.js +0 -1
- package/build/esm/src/tabnote.js +2 -8
- package/build/esm/src/textbracket.js +0 -3
- package/build/esm/src/textnote.js +0 -2
- package/build/esm/src/timesignature.js +2 -4
- package/build/esm/src/timesignote.js +2 -0
- package/build/esm/src/tuplet.js +37 -30
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +6 -2
- package/build/esm/tests/accidental_tests.js +30 -17
- package/build/esm/tests/annotation_tests.js +12 -12
- package/build/esm/tests/articulation_tests.js +13 -13
- package/build/esm/tests/auto_beam_formatting_tests.js +33 -33
- package/build/esm/tests/beam_tests.js +1 -1
- package/build/esm/tests/bend_tests.js +7 -7
- package/build/esm/tests/chordsymbol_tests.js +8 -8
- package/build/esm/tests/curve_tests.js +34 -0
- package/build/esm/tests/{bach_tests.js → demo_petzold_tests.js} +7 -7
- package/build/esm/tests/dot_tests.js +4 -4
- package/build/esm/tests/formatter_tests.js +25 -25
- package/build/esm/tests/gracenote_tests.js +2 -1
- package/build/esm/tests/gracetabnote_tests.js +1 -1
- package/build/esm/tests/index.js +1 -1
- package/build/esm/tests/key_clef_tests.js +6 -6
- package/build/esm/tests/keysignature_tests.js +20 -17
- package/build/esm/tests/notehead_tests.js +10 -7
- package/build/esm/tests/offscreencanvas_tests.js +1 -1
- package/build/esm/tests/ornament_tests.js +8 -8
- package/build/esm/tests/pedalmarking_tests.js +27 -0
- package/build/esm/tests/percussion_tests.js +6 -3
- package/build/esm/tests/renderer_tests.js +1 -1
- package/build/esm/tests/rests_tests.js +26 -26
- package/build/esm/tests/rhythm_tests.js +15 -15
- package/build/esm/tests/stave_tests.js +44 -43
- package/build/esm/tests/staveconnector_tests.js +73 -73
- package/build/esm/tests/stavehairpin_tests.js +1 -1
- package/build/esm/tests/stavemodifier_tests.js +3 -3
- package/build/esm/tests/stavenote_tests.js +29 -29
- package/build/esm/tests/stringnumber_tests.js +1 -1
- package/build/esm/tests/strokes_tests.js +1 -1
- package/build/esm/tests/style_tests.js +1 -1
- package/build/esm/tests/tabnote_tests.js +7 -7
- package/build/esm/tests/tabslide_tests.js +6 -6
- package/build/esm/tests/tabstave_tests.js +1 -1
- package/build/esm/tests/tabtie_tests.js +8 -8
- package/build/esm/tests/textnote_tests.js +1 -1
- package/build/esm/tests/threevoice_tests.js +2 -2
- package/build/esm/tests/timesignature_tests.js +23 -13
- package/build/esm/tests/vibrato_tests.js +3 -3
- package/build/esm/tests/voice_tests.js +1 -1
- package/build/types/src/bend.d.ts +6 -0
- package/build/types/src/curve.d.ts +5 -4
- package/build/types/src/element.d.ts +10 -11
- package/build/types/src/factory.d.ts +2 -2
- package/build/types/src/flag.d.ts +12 -0
- package/build/types/src/frethandfinger.d.ts +1 -1
- package/build/types/src/index.d.ts +1 -0
- package/build/types/src/keysignature.d.ts +7 -7
- package/build/types/src/metrics.d.ts +5 -0
- package/build/types/src/modifier.d.ts +1 -1
- package/build/types/src/pedalmarking.d.ts +2 -2
- package/build/types/src/stave.d.ts +1 -3
- package/build/types/src/stavebarline.d.ts +1 -1
- package/build/types/src/staveline.d.ts +1 -1
- package/build/types/src/stavemodifier.d.ts +0 -1
- package/build/types/src/staverepetition.d.ts +1 -1
- package/build/types/src/stavesection.d.ts +3 -4
- package/build/types/src/stavetempo.d.ts +1 -2
- package/build/types/src/stavetext.d.ts +1 -2
- package/build/types/src/stavevolta.d.ts +1 -2
- package/build/types/src/stemmablenote.d.ts +2 -3
- package/build/types/src/tuplet.d.ts +2 -12
- package/build/types/src/typeguard.d.ts +1 -0
- package/package.json +32 -28
|
@@ -33,9 +33,9 @@ function drawSingle(options, contextBuilder) {
|
|
|
33
33
|
const connector = new StaveConnector(stave1, stave2);
|
|
34
34
|
connector.setType(StaveConnector.type.SINGLE);
|
|
35
35
|
connector.setContext(ctx);
|
|
36
|
-
stave1.
|
|
37
|
-
stave2.
|
|
38
|
-
connector.
|
|
36
|
+
stave1.drawWithStyle();
|
|
37
|
+
stave2.drawWithStyle();
|
|
38
|
+
connector.drawWithStyle();
|
|
39
39
|
options.assert.ok(true, 'all pass');
|
|
40
40
|
}
|
|
41
41
|
function drawSingle4pxStaveLines(options, contextBuilder) {
|
|
@@ -49,9 +49,9 @@ function drawSingle4pxStaveLines(options, contextBuilder) {
|
|
|
49
49
|
const connector = new StaveConnector(stave1, stave2);
|
|
50
50
|
connector.setType(StaveConnector.type.SINGLE);
|
|
51
51
|
connector.setContext(ctx);
|
|
52
|
-
stave1.
|
|
53
|
-
stave2.
|
|
54
|
-
connector.
|
|
52
|
+
stave1.drawWithStyle();
|
|
53
|
+
stave2.drawWithStyle();
|
|
54
|
+
connector.drawWithStyle();
|
|
55
55
|
VexFlow.STAVE_LINE_THICKNESS = oldThickness;
|
|
56
56
|
options.assert.ok(true, 'all pass');
|
|
57
57
|
}
|
|
@@ -67,10 +67,10 @@ function drawSingleBoth(options, contextBuilder) {
|
|
|
67
67
|
const connector2 = new StaveConnector(stave1, stave2);
|
|
68
68
|
connector2.setType(StaveConnector.type.SINGLE_RIGHT);
|
|
69
69
|
connector2.setContext(ctx);
|
|
70
|
-
stave1.
|
|
71
|
-
stave2.
|
|
72
|
-
connector1.
|
|
73
|
-
connector2.
|
|
70
|
+
stave1.drawWithStyle();
|
|
71
|
+
stave2.drawWithStyle();
|
|
72
|
+
connector1.drawWithStyle();
|
|
73
|
+
connector2.drawWithStyle();
|
|
74
74
|
options.assert.ok(true, 'all pass');
|
|
75
75
|
}
|
|
76
76
|
function drawDouble(options, contextBuilder) {
|
|
@@ -86,10 +86,10 @@ function drawDouble(options, contextBuilder) {
|
|
|
86
86
|
line.setType(StaveConnector.type.SINGLE);
|
|
87
87
|
connector.setContext(ctx);
|
|
88
88
|
line.setContext(ctx);
|
|
89
|
-
stave1.
|
|
90
|
-
stave2.
|
|
91
|
-
connector.
|
|
92
|
-
line.
|
|
89
|
+
stave1.drawWithStyle();
|
|
90
|
+
stave2.drawWithStyle();
|
|
91
|
+
connector.drawWithStyle();
|
|
92
|
+
line.drawWithStyle();
|
|
93
93
|
options.assert.ok(true, 'all pass');
|
|
94
94
|
}
|
|
95
95
|
function drawBrace(options, contextBuilder) {
|
|
@@ -106,10 +106,10 @@ function drawBrace(options, contextBuilder) {
|
|
|
106
106
|
line.setType(StaveConnector.type.SINGLE);
|
|
107
107
|
connector.setContext(ctx);
|
|
108
108
|
line.setContext(ctx);
|
|
109
|
-
stave1.
|
|
110
|
-
stave2.
|
|
111
|
-
connector.
|
|
112
|
-
line.
|
|
109
|
+
stave1.drawWithStyle();
|
|
110
|
+
stave2.drawWithStyle();
|
|
111
|
+
connector.drawWithStyle();
|
|
112
|
+
line.drawWithStyle();
|
|
113
113
|
options.assert.ok(true, 'all pass');
|
|
114
114
|
}
|
|
115
115
|
function drawBraceWide(options, contextBuilder) {
|
|
@@ -125,10 +125,10 @@ function drawBraceWide(options, contextBuilder) {
|
|
|
125
125
|
line.setType(StaveConnector.type.SINGLE);
|
|
126
126
|
connector.setContext(ctx);
|
|
127
127
|
line.setContext(ctx);
|
|
128
|
-
stave1.
|
|
129
|
-
stave2.
|
|
130
|
-
connector.
|
|
131
|
-
line.
|
|
128
|
+
stave1.drawWithStyle();
|
|
129
|
+
stave2.drawWithStyle();
|
|
130
|
+
connector.drawWithStyle();
|
|
131
|
+
line.drawWithStyle();
|
|
132
132
|
options.assert.ok(true, 'all pass');
|
|
133
133
|
}
|
|
134
134
|
function drawBracket(options, contextBuilder) {
|
|
@@ -144,10 +144,10 @@ function drawBracket(options, contextBuilder) {
|
|
|
144
144
|
line.setType(StaveConnector.type.SINGLE);
|
|
145
145
|
connector.setContext(ctx);
|
|
146
146
|
line.setContext(ctx);
|
|
147
|
-
stave1.
|
|
148
|
-
stave2.
|
|
149
|
-
connector.
|
|
150
|
-
line.
|
|
147
|
+
stave1.drawWithStyle();
|
|
148
|
+
stave2.drawWithStyle();
|
|
149
|
+
connector.drawWithStyle();
|
|
150
|
+
line.drawWithStyle();
|
|
151
151
|
options.assert.ok(true, 'all pass');
|
|
152
152
|
}
|
|
153
153
|
function drawRepeatBegin(options, contextBuilder) {
|
|
@@ -161,9 +161,9 @@ function drawRepeatBegin(options, contextBuilder) {
|
|
|
161
161
|
const line = new StaveConnector(stave1, stave2);
|
|
162
162
|
line.setType(StaveConnector.type.BOLD_DOUBLE_LEFT);
|
|
163
163
|
line.setContext(ctx);
|
|
164
|
-
stave1.
|
|
165
|
-
stave2.
|
|
166
|
-
line.
|
|
164
|
+
stave1.drawWithStyle();
|
|
165
|
+
stave2.drawWithStyle();
|
|
166
|
+
line.drawWithStyle();
|
|
167
167
|
options.assert.ok(true, 'all pass');
|
|
168
168
|
}
|
|
169
169
|
function drawRepeatEnd(options, contextBuilder) {
|
|
@@ -177,9 +177,9 @@ function drawRepeatEnd(options, contextBuilder) {
|
|
|
177
177
|
const line = new StaveConnector(stave1, stave2);
|
|
178
178
|
line.setType(StaveConnector.type.BOLD_DOUBLE_RIGHT);
|
|
179
179
|
line.setContext(ctx);
|
|
180
|
-
stave1.
|
|
181
|
-
stave2.
|
|
182
|
-
line.
|
|
180
|
+
stave1.drawWithStyle();
|
|
181
|
+
stave2.drawWithStyle();
|
|
182
|
+
line.drawWithStyle();
|
|
183
183
|
options.assert.ok(true, 'all pass');
|
|
184
184
|
}
|
|
185
185
|
function drawThinDouble(options, contextBuilder) {
|
|
@@ -193,9 +193,9 @@ function drawThinDouble(options, contextBuilder) {
|
|
|
193
193
|
const line = new StaveConnector(stave1, stave2);
|
|
194
194
|
line.setType(StaveConnector.type.THIN_DOUBLE);
|
|
195
195
|
line.setContext(ctx);
|
|
196
|
-
stave1.
|
|
197
|
-
stave2.
|
|
198
|
-
line.
|
|
196
|
+
stave1.drawWithStyle();
|
|
197
|
+
stave2.drawWithStyle();
|
|
198
|
+
line.drawWithStyle();
|
|
199
199
|
options.assert.ok(true, 'all pass');
|
|
200
200
|
}
|
|
201
201
|
function drawRepeatAdjacent(options, contextBuilder) {
|
|
@@ -228,14 +228,14 @@ function drawRepeatAdjacent(options, contextBuilder) {
|
|
|
228
228
|
connector2.setType(StaveConnector.type.BOLD_DOUBLE_RIGHT);
|
|
229
229
|
connector3.setType(StaveConnector.type.BOLD_DOUBLE_LEFT);
|
|
230
230
|
connector4.setType(StaveConnector.type.BOLD_DOUBLE_RIGHT);
|
|
231
|
-
stave1.
|
|
232
|
-
stave2.
|
|
233
|
-
stave3.
|
|
234
|
-
stave4.
|
|
235
|
-
connector1.
|
|
236
|
-
connector2.
|
|
237
|
-
connector3.
|
|
238
|
-
connector4.
|
|
231
|
+
stave1.drawWithStyle();
|
|
232
|
+
stave2.drawWithStyle();
|
|
233
|
+
stave3.drawWithStyle();
|
|
234
|
+
stave4.drawWithStyle();
|
|
235
|
+
connector1.drawWithStyle();
|
|
236
|
+
connector2.drawWithStyle();
|
|
237
|
+
connector3.drawWithStyle();
|
|
238
|
+
connector4.drawWithStyle();
|
|
239
239
|
options.assert.ok(true, 'all pass');
|
|
240
240
|
}
|
|
241
241
|
function drawRepeatOffset2(options, contextBuilder) {
|
|
@@ -281,15 +281,15 @@ function drawRepeatOffset2(options, contextBuilder) {
|
|
|
281
281
|
connector5.setType(StaveConnector.type.SINGLE_LEFT);
|
|
282
282
|
connector1.setXShift(stave1.getModifierXShift());
|
|
283
283
|
connector3.setXShift(stave3.getModifierXShift());
|
|
284
|
-
stave1.
|
|
285
|
-
stave2.
|
|
286
|
-
stave3.
|
|
287
|
-
stave4.
|
|
288
|
-
connector1.
|
|
289
|
-
connector2.
|
|
290
|
-
connector3.
|
|
291
|
-
connector4.
|
|
292
|
-
connector5.
|
|
284
|
+
stave1.drawWithStyle();
|
|
285
|
+
stave2.drawWithStyle();
|
|
286
|
+
stave3.drawWithStyle();
|
|
287
|
+
stave4.drawWithStyle();
|
|
288
|
+
connector1.drawWithStyle();
|
|
289
|
+
connector2.drawWithStyle();
|
|
290
|
+
connector3.drawWithStyle();
|
|
291
|
+
connector4.drawWithStyle();
|
|
292
|
+
connector5.drawWithStyle();
|
|
293
293
|
options.assert.ok(true, 'all pass');
|
|
294
294
|
}
|
|
295
295
|
function drawRepeatOffset(options, contextBuilder) {
|
|
@@ -337,15 +337,15 @@ function drawRepeatOffset(options, contextBuilder) {
|
|
|
337
337
|
connector5.setType(StaveConnector.type.SINGLE_LEFT);
|
|
338
338
|
connector1.setXShift(stave1.getModifierXShift());
|
|
339
339
|
connector3.setXShift(stave3.getModifierXShift());
|
|
340
|
-
stave1.
|
|
341
|
-
stave2.
|
|
342
|
-
stave3.
|
|
343
|
-
stave4.
|
|
344
|
-
connector1.
|
|
345
|
-
connector2.
|
|
346
|
-
connector3.
|
|
347
|
-
connector4.
|
|
348
|
-
connector5.
|
|
340
|
+
stave1.drawWithStyle();
|
|
341
|
+
stave2.drawWithStyle();
|
|
342
|
+
stave3.drawWithStyle();
|
|
343
|
+
stave4.drawWithStyle();
|
|
344
|
+
connector1.drawWithStyle();
|
|
345
|
+
connector2.drawWithStyle();
|
|
346
|
+
connector3.drawWithStyle();
|
|
347
|
+
connector4.drawWithStyle();
|
|
348
|
+
connector5.drawWithStyle();
|
|
349
349
|
options.assert.ok(true, 'all pass');
|
|
350
350
|
}
|
|
351
351
|
function drawCombined(options, contextBuilder) {
|
|
@@ -384,18 +384,18 @@ function drawCombined(options, contextBuilder) {
|
|
|
384
384
|
connBracket.setContext(ctx);
|
|
385
385
|
connNone.setContext(ctx);
|
|
386
386
|
connBrace.setContext(ctx);
|
|
387
|
-
stave1.
|
|
388
|
-
stave2.
|
|
389
|
-
stave3.
|
|
390
|
-
stave4.
|
|
391
|
-
stave5.
|
|
392
|
-
stave6.
|
|
393
|
-
stave7.
|
|
394
|
-
connSingle.
|
|
395
|
-
connDouble.
|
|
396
|
-
connBracket.
|
|
397
|
-
connNone.
|
|
398
|
-
connBrace.
|
|
387
|
+
stave1.drawWithStyle();
|
|
388
|
+
stave2.drawWithStyle();
|
|
389
|
+
stave3.drawWithStyle();
|
|
390
|
+
stave4.drawWithStyle();
|
|
391
|
+
stave5.drawWithStyle();
|
|
392
|
+
stave6.drawWithStyle();
|
|
393
|
+
stave7.drawWithStyle();
|
|
394
|
+
connSingle.drawWithStyle();
|
|
395
|
+
connDouble.drawWithStyle();
|
|
396
|
+
connBracket.drawWithStyle();
|
|
397
|
+
connNone.drawWithStyle();
|
|
398
|
+
connBrace.drawWithStyle();
|
|
399
399
|
options.assert.ok(true, 'all pass');
|
|
400
400
|
}
|
|
401
401
|
VexFlowTests.register(StaveConnectorTests);
|
|
@@ -14,7 +14,7 @@ function draw(options, contextBuilder) {
|
|
|
14
14
|
const ctx = contextBuilder(options.elementId, 400, 120);
|
|
15
15
|
const stave = new Stave(10, 10, 300);
|
|
16
16
|
stave.setContext(ctx);
|
|
17
|
-
stave.
|
|
17
|
+
stave.drawWithStyle();
|
|
18
18
|
options.assert.equal(stave.getYForNote(0), 100, 'getYForNote(0)');
|
|
19
19
|
options.assert.equal(stave.getYForLine(5), 100, 'getYForLine(5)');
|
|
20
20
|
options.assert.equal(stave.getYForLine(0), 50, 'getYForLine(0) - Top Line');
|
|
@@ -33,7 +33,7 @@ function drawBeginAndEnd(options, contextBuilder) {
|
|
|
33
33
|
stave.setEndTimeSignature('9/8');
|
|
34
34
|
stave.setEndKeySignature('G', 'C#');
|
|
35
35
|
stave.setEndBarType(BarlineType.DOUBLE);
|
|
36
|
-
stave.
|
|
36
|
+
stave.drawWithStyle();
|
|
37
37
|
const END = StaveModifierPosition.END;
|
|
38
38
|
stave.setY(100);
|
|
39
39
|
stave.setTimeSignature('3/4');
|
|
@@ -44,7 +44,7 @@ function drawBeginAndEnd(options, contextBuilder) {
|
|
|
44
44
|
stave.setTimeSignature('C', undefined, END);
|
|
45
45
|
stave.setKeySignature('F', undefined, END);
|
|
46
46
|
stave.setEndBarType(BarlineType.SINGLE);
|
|
47
|
-
stave.
|
|
47
|
+
stave.drawWithStyle();
|
|
48
48
|
options.assert.ok(true, 'all pass');
|
|
49
49
|
}
|
|
50
50
|
VexFlowTests.register(StaveModifierTests);
|
|
@@ -72,7 +72,7 @@ function draw(note, stave, context, x, drawBoundingBox = false, addModifierConte
|
|
|
72
72
|
note.addToModifierContext(new ModifierContext());
|
|
73
73
|
}
|
|
74
74
|
new TickContext().addTickable(note).preFormat().setX(x);
|
|
75
|
-
note.setContext(context).
|
|
75
|
+
note.setContext(context).drawWithStyle();
|
|
76
76
|
if (drawBoundingBox) {
|
|
77
77
|
const bb = note.getBoundingBox();
|
|
78
78
|
context.rect(bb.getX(), bb.getY(), bb.getW(), bb.getH());
|
|
@@ -239,7 +239,7 @@ function drawBasic(options, contextBuilder) {
|
|
|
239
239
|
const stave = new Stave(10, 30, 750);
|
|
240
240
|
stave.setContext(ctx);
|
|
241
241
|
stave.addClef(clef);
|
|
242
|
-
stave.
|
|
242
|
+
stave.drawWithStyle();
|
|
243
243
|
const lowerKeys = ['c/', 'e/', 'a/'];
|
|
244
244
|
const higherKeys = ['c/', 'e/', 'a/'];
|
|
245
245
|
for (let k = 0; k < lowerKeys.length; k++) {
|
|
@@ -303,7 +303,7 @@ function drawBoundingBoxes(options, contextBuilder) {
|
|
|
303
303
|
const stave = new Stave(10, 30, 750);
|
|
304
304
|
stave.setContext(ctx);
|
|
305
305
|
stave.addClef(clef);
|
|
306
|
-
stave.
|
|
306
|
+
stave.drawWithStyle();
|
|
307
307
|
const lowerKeys = ['c/', 'e/', 'a/'];
|
|
308
308
|
const higherKeys = ['c/', 'e/', 'a/'];
|
|
309
309
|
for (let k = 0; k < lowerKeys.length; k++) {
|
|
@@ -361,7 +361,7 @@ function drawBass(options, contextBuilder) {
|
|
|
361
361
|
const stave = new Stave(10, 10, 650);
|
|
362
362
|
stave.setContext(ctx);
|
|
363
363
|
stave.addClef('bass');
|
|
364
|
-
stave.
|
|
364
|
+
stave.drawWithStyle();
|
|
365
365
|
const noteStructs = [
|
|
366
366
|
{ clef: 'bass', keys: ['c/3', 'e/3', 'a/3'], duration: '1/2' },
|
|
367
367
|
{ clef: 'bass', keys: ['c/2', 'e/2', 'a/2'], duration: 'w' },
|
|
@@ -395,7 +395,7 @@ function displacements(options, contextBuilder) {
|
|
|
395
395
|
ctx.scale(0.9, 0.9);
|
|
396
396
|
const stave = new Stave(10, 10, 675);
|
|
397
397
|
stave.setContext(ctx);
|
|
398
|
-
stave.
|
|
398
|
+
stave.drawWithStyle();
|
|
399
399
|
const noteStructs = [
|
|
400
400
|
{ keys: ['g/3', 'a/3', 'c/4', 'd/4', 'e/4'], duration: '1/2' },
|
|
401
401
|
{ keys: ['g/3', 'a/3', 'c/4', 'd/4', 'e/4'], duration: 'w' },
|
|
@@ -427,7 +427,7 @@ function drawHarmonicAndMuted(options, contextBuilder) {
|
|
|
427
427
|
const ctx = contextBuilder(options.elementId, 1000, 180);
|
|
428
428
|
const stave = new Stave(10, 10, 950);
|
|
429
429
|
stave.setContext(ctx);
|
|
430
|
-
stave.
|
|
430
|
+
stave.drawWithStyle();
|
|
431
431
|
const noteStructs = [
|
|
432
432
|
{ keys: ['c/4', 'e/4', 'a/4'], duration: '1/2h' },
|
|
433
433
|
{ keys: ['c/4', 'e/4', 'a/4'], duration: 'wh' },
|
|
@@ -477,7 +477,7 @@ function drawSlash(options, contextBuilder) {
|
|
|
477
477
|
const ctx = contextBuilder(options.elementId, 700, 180);
|
|
478
478
|
const stave = new Stave(10, 10, 650);
|
|
479
479
|
stave.setContext(ctx);
|
|
480
|
-
stave.
|
|
480
|
+
stave.drawWithStyle();
|
|
481
481
|
const notes = [
|
|
482
482
|
{ keys: ['b/4'], duration: '1/2s', stemDirection: Stem.DOWN },
|
|
483
483
|
{ keys: ['b/4'], duration: 'ws', stemDirection: Stem.DOWN },
|
|
@@ -506,8 +506,8 @@ function drawSlash(options, contextBuilder) {
|
|
|
506
506
|
const beam1 = new Beam([staveNotes[16], staveNotes[17]]);
|
|
507
507
|
const beam2 = new Beam([staveNotes[18], staveNotes[19]]);
|
|
508
508
|
Formatter.FormatAndDraw(ctx, stave, staveNotes, false);
|
|
509
|
-
beam1.setContext(ctx).
|
|
510
|
-
beam2.setContext(ctx).
|
|
509
|
+
beam1.setContext(ctx).drawWithStyle();
|
|
510
|
+
beam2.setContext(ctx).drawWithStyle();
|
|
511
511
|
options.assert.ok('Slash Note Heads');
|
|
512
512
|
}
|
|
513
513
|
function drawKeyStyles(options, contextBuilder) {
|
|
@@ -519,8 +519,8 @@ function drawKeyStyles(options, contextBuilder) {
|
|
|
519
519
|
.addModifier(new Accidental('b'), 1)
|
|
520
520
|
.setKeyStyle(1, { shadowBlur: 2, shadowColor: 'blue', fillStyle: 'blue' });
|
|
521
521
|
new TickContext().addTickable(note).preFormat().setX(25);
|
|
522
|
-
stave.setContext(ctx).
|
|
523
|
-
note.setContext(ctx).
|
|
522
|
+
stave.setContext(ctx).drawWithStyle();
|
|
523
|
+
note.setContext(ctx).drawWithStyle();
|
|
524
524
|
options.assert.ok(note.getX() > 0, 'Note has X value');
|
|
525
525
|
options.assert.ok(note.getYs().length > 0, 'Note has Y values');
|
|
526
526
|
}
|
|
@@ -533,8 +533,8 @@ function drawNoteStyles(options, contextBuilder) {
|
|
|
533
533
|
.addModifier(new Accidental('b'), 1);
|
|
534
534
|
note.setStyle({ shadowBlur: 2, shadowColor: 'blue', fillStyle: 'blue', strokeStyle: 'blue' });
|
|
535
535
|
new TickContext().addTickable(note).preFormat().setX(25);
|
|
536
|
-
stave.setContext(ctx).
|
|
537
|
-
note.setContext(ctx).
|
|
536
|
+
stave.setContext(ctx).drawWithStyle();
|
|
537
|
+
note.setContext(ctx).drawWithStyle();
|
|
538
538
|
options.assert.ok(note.getX() > 0, 'Note has X value');
|
|
539
539
|
options.assert.ok(note.getYs().length > 0, 'Note has Y values');
|
|
540
540
|
}
|
|
@@ -547,14 +547,14 @@ function drawNoteStemStyles(options, contextBuilder) {
|
|
|
547
547
|
.addModifier(new Accidental('b'), 1);
|
|
548
548
|
note.setStemStyle({ shadowBlur: 2, shadowColor: 'blue', fillStyle: 'blue', strokeStyle: 'blue' });
|
|
549
549
|
new TickContext().addTickable(note).preFormat().setX(25);
|
|
550
|
-
stave.setContext(ctx).
|
|
551
|
-
note.setContext(ctx).
|
|
550
|
+
stave.setContext(ctx).drawWithStyle();
|
|
551
|
+
note.setContext(ctx).drawWithStyle();
|
|
552
552
|
options.assert.ok('Note Stem Style');
|
|
553
553
|
}
|
|
554
554
|
function drawNoteStemLengths(options, contextBuilder) {
|
|
555
555
|
const ctx = contextBuilder(options.elementId, 975, 150);
|
|
556
556
|
const stave = new Stave(10, 10, 975);
|
|
557
|
-
stave.setContext(ctx).
|
|
557
|
+
stave.setContext(ctx).drawWithStyle();
|
|
558
558
|
const keys = [
|
|
559
559
|
'e/3',
|
|
560
560
|
'f/3',
|
|
@@ -609,8 +609,8 @@ function drawNoteStylesWithFlag(options, contextBuilder) {
|
|
|
609
609
|
.addModifier(new Accidental('b'), 1);
|
|
610
610
|
note.setFlagStyle({ shadowBlur: 2, shadowColor: 'blue', fillStyle: 'blue', strokeStyle: 'blue' });
|
|
611
611
|
new TickContext().addTickable(note).preFormat().setX(25);
|
|
612
|
-
stave.setContext(ctx).
|
|
613
|
-
note.setContext(ctx).
|
|
612
|
+
stave.setContext(ctx).drawWithStyle();
|
|
613
|
+
note.setContext(ctx).drawWithStyle();
|
|
614
614
|
options.assert.ok(note.getX() > 0, 'Note has X value');
|
|
615
615
|
options.assert.ok(note.getYs().length > 0, 'Note has Y values');
|
|
616
616
|
}
|
|
@@ -619,7 +619,7 @@ function drawBeamStyles(options, contextBuilder) {
|
|
|
619
619
|
const stave = new Stave(10, 10, 380);
|
|
620
620
|
stave.setStyle({ strokeStyle: '#EEAAEE', lineWidth: 3 });
|
|
621
621
|
stave.setContext(ctx);
|
|
622
|
-
stave.
|
|
622
|
+
stave.drawWithStyle();
|
|
623
623
|
const notes = [
|
|
624
624
|
{ keys: ['b/4'], duration: '8', stemDirection: Stem.DOWN },
|
|
625
625
|
{ keys: ['b/4'], duration: '8', stemDirection: Stem.DOWN },
|
|
@@ -648,10 +648,10 @@ function drawBeamStyles(options, contextBuilder) {
|
|
|
648
648
|
staveNotes[9].setLedgerLineStyle({ fillStyle: 'lawngreen', strokeStyle: 'lawngreen', lineWidth: 1 });
|
|
649
649
|
staveNotes[9].setFlagStyle({ fillStyle: 'orange', strokeStyle: 'orange' });
|
|
650
650
|
Formatter.FormatAndDraw(ctx, stave, staveNotes, false);
|
|
651
|
-
beam1.setContext(ctx).
|
|
652
|
-
beam2.setContext(ctx).
|
|
653
|
-
beam3.setContext(ctx).
|
|
654
|
-
beam4.setContext(ctx).
|
|
651
|
+
beam1.setContext(ctx).drawWithStyle();
|
|
652
|
+
beam2.setContext(ctx).drawWithStyle();
|
|
653
|
+
beam3.setContext(ctx).drawWithStyle();
|
|
654
|
+
beam4.setContext(ctx).drawWithStyle();
|
|
655
655
|
options.assert.ok('draw beam styles');
|
|
656
656
|
}
|
|
657
657
|
function dotsAndFlagsStemUp(options, contextBuilder) {
|
|
@@ -674,7 +674,7 @@ function dotsAndFlagsStemUp(options, contextBuilder) {
|
|
|
674
674
|
];
|
|
675
675
|
Dot.buildAndAttach(notes, { all: true });
|
|
676
676
|
Dot.buildAndAttach([notes[5], notes[11]], { all: true });
|
|
677
|
-
stave.setContext(ctx).
|
|
677
|
+
stave.setContext(ctx).drawWithStyle();
|
|
678
678
|
for (let i = 0; i < notes.length; ++i) {
|
|
679
679
|
draw(notes[i], stave, ctx, i * 65);
|
|
680
680
|
}
|
|
@@ -699,7 +699,7 @@ function dotsAndFlagsStemDown(options, contextBuilder) {
|
|
|
699
699
|
staveNote({ keys: ['d/5'], duration: '128', stemDirection: Stem.DOWN }),
|
|
700
700
|
];
|
|
701
701
|
Dot.buildAndAttach(staveNotes, { all: true });
|
|
702
|
-
stave.setContext(ctx).
|
|
702
|
+
stave.setContext(ctx).drawWithStyle();
|
|
703
703
|
for (let i = 0; i < staveNotes.length; ++i) {
|
|
704
704
|
draw(staveNotes[i], stave, ctx, i * 65);
|
|
705
705
|
}
|
|
@@ -724,11 +724,11 @@ function dotsAndBeamsUp(options, contextBuilder) {
|
|
|
724
724
|
Dot.buildAndAttach(staveNotes, { all: true });
|
|
725
725
|
Dot.buildAndAttach([staveNotes[4], staveNotes[9]], { all: true });
|
|
726
726
|
const beam = new Beam(staveNotes);
|
|
727
|
-
stave.setContext(ctx).
|
|
727
|
+
stave.setContext(ctx).drawWithStyle();
|
|
728
728
|
for (let i = 0; i < staveNotes.length; ++i) {
|
|
729
729
|
draw(staveNotes[i], stave, ctx, i * 65);
|
|
730
730
|
}
|
|
731
|
-
beam.setContext(ctx).
|
|
731
|
+
beam.setContext(ctx).drawWithStyle();
|
|
732
732
|
options.assert.ok(true, 'Full Dot');
|
|
733
733
|
}
|
|
734
734
|
function dotsAndBeamsDown(options, contextBuilder) {
|
|
@@ -749,11 +749,11 @@ function dotsAndBeamsDown(options, contextBuilder) {
|
|
|
749
749
|
];
|
|
750
750
|
Dot.buildAndAttach(staveNotes, { all: true });
|
|
751
751
|
const beam = new Beam(staveNotes);
|
|
752
|
-
stave.setContext(ctx).
|
|
752
|
+
stave.setContext(ctx).drawWithStyle();
|
|
753
753
|
for (let i = 0; i < staveNotes.length; ++i) {
|
|
754
754
|
draw(staveNotes[i], stave, ctx, i * 65);
|
|
755
755
|
}
|
|
756
|
-
beam.setContext(ctx).
|
|
756
|
+
beam.setContext(ctx).drawWithStyle();
|
|
757
757
|
options.assert.ok(true, 'Full Dot');
|
|
758
758
|
}
|
|
759
759
|
function noteHeadsSimple(options) {
|
|
@@ -267,7 +267,7 @@ function notesWithTab(options) {
|
|
|
267
267
|
f.Formatter().joinVoices([voice]).joinVoices([tabVoice]).formatToStave([voice, tabVoice], stave);
|
|
268
268
|
f.draw();
|
|
269
269
|
beams.forEach(function (beam) {
|
|
270
|
-
beam.setContext(f.getContext()).
|
|
270
|
+
beam.setContext(f.getContext()).drawWithStyle();
|
|
271
271
|
});
|
|
272
272
|
options.assert.ok(true);
|
|
273
273
|
}
|
|
@@ -69,7 +69,7 @@ function tab(options, contextBuilder) {
|
|
|
69
69
|
ctx.font = '10pt Arial';
|
|
70
70
|
const stave = new TabStave(10, 10, 450).addTabGlyph();
|
|
71
71
|
stave.getModifiers()[2].setStyle(FS('blue'));
|
|
72
|
-
stave.setContext(ctx).
|
|
72
|
+
stave.setContext(ctx).drawWithStyle();
|
|
73
73
|
const tabNote = (noteStruct) => new TabNote(noteStruct);
|
|
74
74
|
const notes = [
|
|
75
75
|
tabNote({
|
|
@@ -66,7 +66,7 @@ function draw(options, contextBuilder) {
|
|
|
66
66
|
ctx.font = '10pt Arial';
|
|
67
67
|
const stave = new TabStave(10, 10, 550);
|
|
68
68
|
stave.setContext(ctx);
|
|
69
|
-
stave.
|
|
69
|
+
stave.drawWithStyle();
|
|
70
70
|
const notes = [
|
|
71
71
|
{ positions: [{ str: 6, fret: 6 }], duration: '4' },
|
|
72
72
|
{
|
|
@@ -121,7 +121,7 @@ function draw(options, contextBuilder) {
|
|
|
121
121
|
const tickContext = new TickContext();
|
|
122
122
|
tickContext.addTickable(tabNote).preFormat().setX(x);
|
|
123
123
|
tabNote.setContext(ctx).setStave(stave);
|
|
124
|
-
tabNote.
|
|
124
|
+
tabNote.drawWithStyle();
|
|
125
125
|
return tabNote;
|
|
126
126
|
}
|
|
127
127
|
for (let i = 0; i < notes.length; ++i) {
|
|
@@ -136,7 +136,7 @@ function drawStemsUp(options, contextBuilder) {
|
|
|
136
136
|
ctx.font = '10pt Arial';
|
|
137
137
|
const stave = new TabStave(10, 30, 550);
|
|
138
138
|
stave.setContext(ctx);
|
|
139
|
-
stave.
|
|
139
|
+
stave.drawWithStyle();
|
|
140
140
|
const specs = [
|
|
141
141
|
{
|
|
142
142
|
positions: [
|
|
@@ -204,7 +204,7 @@ function drawStemsDown(options, contextBuilder) {
|
|
|
204
204
|
ctx.font = '10pt Arial';
|
|
205
205
|
const stave = new TabStave(10, 10, 550);
|
|
206
206
|
stave.setContext(ctx);
|
|
207
|
-
stave.
|
|
207
|
+
stave.drawWithStyle();
|
|
208
208
|
const specs = [
|
|
209
209
|
{
|
|
210
210
|
positions: [
|
|
@@ -273,7 +273,7 @@ function drawStemsUpThrough(options, contextBuilder) {
|
|
|
273
273
|
ctx.font = '10pt Arial';
|
|
274
274
|
const stave = new TabStave(10, 30, 550);
|
|
275
275
|
stave.setContext(ctx);
|
|
276
|
-
stave.
|
|
276
|
+
stave.drawWithStyle();
|
|
277
277
|
const specs = [
|
|
278
278
|
{
|
|
279
279
|
positions: [
|
|
@@ -343,7 +343,7 @@ function drawStemsDownThrough(options, contextBuilder) {
|
|
|
343
343
|
ctx.font = '10pt Arial';
|
|
344
344
|
const stave = new TabStave(10, 10, 550, { numLines: 8 });
|
|
345
345
|
stave.setContext(ctx);
|
|
346
|
-
stave.
|
|
346
|
+
stave.drawWithStyle();
|
|
347
347
|
const specs = [
|
|
348
348
|
{
|
|
349
349
|
positions: [
|
|
@@ -417,7 +417,7 @@ function drawStemsDotted(options, contextBuilder) {
|
|
|
417
417
|
ctx.font = '10pt Arial';
|
|
418
418
|
const stave = new TabStave(10, 10, 550);
|
|
419
419
|
stave.setContext(ctx);
|
|
420
|
-
stave.
|
|
420
|
+
stave.drawWithStyle();
|
|
421
421
|
const specs = [
|
|
422
422
|
{
|
|
423
423
|
positions: [
|
|
@@ -26,13 +26,13 @@ function tieNotes(notes, indexes, stave, ctx) {
|
|
|
26
26
|
lastIndexes: indexes,
|
|
27
27
|
}, TabSlide.SLIDE_UP);
|
|
28
28
|
tie.setContext(ctx);
|
|
29
|
-
tie.
|
|
29
|
+
tie.drawWithStyle();
|
|
30
30
|
}
|
|
31
31
|
function setupContext(options, width) {
|
|
32
32
|
const context = options.contextBuilder(options.elementId, 350, 140);
|
|
33
33
|
context.scale(0.9, 0.9);
|
|
34
34
|
context.font = '10pt Arial';
|
|
35
|
-
const stave = new TabStave(10, 10, width || 350).addTabGlyph().setContext(context).
|
|
35
|
+
const stave = new TabStave(10, 10, width || 350).addTabGlyph().setContext(context).drawWithStyle();
|
|
36
36
|
return { context, stave };
|
|
37
37
|
}
|
|
38
38
|
const tabNote = (noteStruct) => new TabNote(noteStruct);
|
|
@@ -91,7 +91,7 @@ function multiTest(options, buildTabSlide) {
|
|
|
91
91
|
lastIndexes: [0],
|
|
92
92
|
})
|
|
93
93
|
.setContext(context)
|
|
94
|
-
.
|
|
94
|
+
.drawWithStyle();
|
|
95
95
|
options.assert.ok(true, 'Single note');
|
|
96
96
|
buildTabSlide({
|
|
97
97
|
firstNote: notes[2],
|
|
@@ -100,7 +100,7 @@ function multiTest(options, buildTabSlide) {
|
|
|
100
100
|
lastIndexes: [0, 1],
|
|
101
101
|
})
|
|
102
102
|
.setContext(context)
|
|
103
|
-
.
|
|
103
|
+
.drawWithStyle();
|
|
104
104
|
options.assert.ok(true, 'Chord');
|
|
105
105
|
buildTabSlide({
|
|
106
106
|
firstNote: notes[4],
|
|
@@ -109,7 +109,7 @@ function multiTest(options, buildTabSlide) {
|
|
|
109
109
|
lastIndexes: [0],
|
|
110
110
|
})
|
|
111
111
|
.setContext(context)
|
|
112
|
-
.
|
|
112
|
+
.drawWithStyle();
|
|
113
113
|
options.assert.ok(true, 'Single note high-fret');
|
|
114
114
|
buildTabSlide({
|
|
115
115
|
firstNote: notes[6],
|
|
@@ -118,7 +118,7 @@ function multiTest(options, buildTabSlide) {
|
|
|
118
118
|
lastIndexes: [0, 1],
|
|
119
119
|
})
|
|
120
120
|
.setContext(context)
|
|
121
|
-
.
|
|
121
|
+
.drawWithStyle();
|
|
122
122
|
options.assert.ok(true, 'Chord high-fret');
|
|
123
123
|
}
|
|
124
124
|
function slideUp(options, contextBuilder) {
|
|
@@ -13,7 +13,7 @@ function draw(options, contextBuilder) {
|
|
|
13
13
|
stave.setMeasure(1);
|
|
14
14
|
stave.setNumLines(6);
|
|
15
15
|
stave.setContext(ctx);
|
|
16
|
-
stave.
|
|
16
|
+
stave.drawWithStyle();
|
|
17
17
|
options.assert.equal(stave.getYForNote(0), 127, 'getYForNote(0)');
|
|
18
18
|
options.assert.equal(stave.getYForLine(5), 127, 'getYForLine(5)');
|
|
19
19
|
options.assert.equal(stave.getYForLine(0), 62, 'getYForLine(0) - Top Line');
|