vexflow 5.0.0-alpha.3 → 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 +2066 -1877
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +1052 -993
- 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/accidental.js +22 -28
- package/build/esm/src/annotation.js +0 -2
- package/build/esm/src/barnote.js +3 -3
- package/build/esm/src/beam.js +26 -46
- 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/clefnote.js +6 -1
- package/build/esm/src/curve.js +8 -5
- package/build/esm/src/element.js +94 -118
- package/build/esm/src/factory.js +4 -4
- package/build/esm/src/flag.js +20 -0
- package/build/esm/src/fonts/gonville.js +1 -1
- package/build/esm/src/formatter.js +13 -21
- package/build/esm/src/fraction.js +15 -22
- package/build/esm/src/glyphnote.js +3 -4
- 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 +58 -7
- package/build/esm/src/modifier.js +10 -23
- package/build/esm/src/multimeasurerest.js +16 -25
- package/build/esm/src/note.js +7 -0
- 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/registry.js +5 -19
- package/build/esm/src/stave.js +11 -19
- 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 +42 -68
- package/build/esm/src/staverepetition.js +3 -2
- package/build/esm/src/stavesection.js +13 -15
- package/build/esm/src/stavetempo.js +7 -13
- package/build/esm/src/stavetext.js +2 -2
- package/build/esm/src/stavetie.js +82 -40
- 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 +5 -13
- 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/tickable.js +13 -26
- package/build/esm/src/tickcontext.js +20 -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/src/vibrato.js +6 -1
- 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/clef_tests.js +5 -1
- 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/glyphnote_tests.js +6 -0
- 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/stavetie_tests.js +29 -0
- 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 +2 -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/vexflow_test_helpers.js +25 -39
- package/build/esm/tests/vibrato_tests.js +3 -3
- package/build/esm/tests/voice_tests.js +1 -1
- package/build/types/src/accidental.d.ts +19 -1
- package/build/types/src/annotation.d.ts +1 -1
- package/build/types/src/beam.d.ts +12 -1
- package/build/types/src/bend.d.ts +6 -0
- package/build/types/src/clefnote.d.ts +2 -0
- package/build/types/src/curve.d.ts +5 -4
- package/build/types/src/element.d.ts +23 -14
- package/build/types/src/factory.d.ts +2 -2
- package/build/types/src/flag.d.ts +12 -0
- package/build/types/src/fonts/gonville.d.ts +1 -1
- package/build/types/src/formatter.d.ts +5 -3
- package/build/types/src/fraction.d.ts +12 -7
- 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 +3 -2
- package/build/types/src/multimeasurerest.d.ts +4 -1
- package/build/types/src/note.d.ts +2 -0
- package/build/types/src/pedalmarking.d.ts +2 -2
- package/build/types/src/registry.d.ts +1 -1
- 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/stavenote.d.ts +2 -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 +4 -5
- package/build/types/src/stavetext.d.ts +1 -2
- package/build/types/src/stavetie.d.ts +39 -2
- package/build/types/src/stavevolta.d.ts +1 -2
- package/build/types/src/stemmablenote.d.ts +2 -3
- package/build/types/src/svgcontext.d.ts +1 -1
- package/build/types/src/tickable.d.ts +2 -1
- package/build/types/src/tickcontext.d.ts +30 -0
- package/build/types/src/tuplet.d.ts +2 -12
- package/build/types/src/typeguard.d.ts +1 -0
- package/package.json +33 -29
- package/tests/flow.html +2 -2
|
@@ -126,9 +126,11 @@ function formatAccidentalSpaces(options) {
|
|
|
126
126
|
duration: '8d',
|
|
127
127
|
}).addModifier(new Accidental('##'), 0),
|
|
128
128
|
new StaveNote({
|
|
129
|
-
keys: ['
|
|
129
|
+
keys: ['Bb/4', 'Bn/4'],
|
|
130
130
|
duration: '16',
|
|
131
|
-
})
|
|
131
|
+
})
|
|
132
|
+
.addModifier(new Accidental('b'), 0)
|
|
133
|
+
.addModifier(new Accidental('n'), 0),
|
|
132
134
|
new StaveNote({
|
|
133
135
|
keys: ['f/3'],
|
|
134
136
|
duration: '8',
|
|
@@ -166,9 +168,11 @@ function formatAccidentalSpaces(options) {
|
|
|
166
168
|
duration: '16',
|
|
167
169
|
}),
|
|
168
170
|
new StaveNote({
|
|
169
|
-
keys: ['
|
|
171
|
+
keys: ['Db/4', 'Dn/4'],
|
|
170
172
|
duration: 'q',
|
|
171
|
-
})
|
|
173
|
+
})
|
|
174
|
+
.addModifier(new Accidental('b'), 0)
|
|
175
|
+
.addModifier(new Accidental('n'), 0),
|
|
172
176
|
];
|
|
173
177
|
Dot.buildAndAttach([notes[0]], { all: true });
|
|
174
178
|
const beams = Beam.generateBeams(notes);
|
|
@@ -180,10 +184,10 @@ function formatAccidentalSpaces(options) {
|
|
|
180
184
|
const formatter = new Formatter({ softmaxFactor }).joinVoices([voice]);
|
|
181
185
|
const width = formatter.preCalculateMinTotalWidth([voice]);
|
|
182
186
|
const stave = new Stave(10, 40, width + 20);
|
|
183
|
-
stave.setContext(context).
|
|
187
|
+
stave.setContext(context).drawWithStyle();
|
|
184
188
|
formatter.format([voice], width);
|
|
185
189
|
voice.draw(context, stave);
|
|
186
|
-
beams.forEach((b) => b.setContext(context).
|
|
190
|
+
beams.forEach((b) => b.setContext(context).drawWithStyle());
|
|
187
191
|
notes.forEach((note) => Note.plotMetrics(context, note, 30));
|
|
188
192
|
VexFlowTests.plotLegendForNoteWidth(context, 300, 150);
|
|
189
193
|
options.assert.ok(true);
|
|
@@ -270,7 +274,15 @@ function genAccidentals() {
|
|
|
270
274
|
accs.push(String.fromCodePoint(u));
|
|
271
275
|
}
|
|
272
276
|
for (let u = 0xe310; u <= 0xe335; u++) {
|
|
273
|
-
|
|
277
|
+
switch (u) {
|
|
278
|
+
case 0xe31a:
|
|
279
|
+
case 0xe31b:
|
|
280
|
+
case 0xe31e:
|
|
281
|
+
case 0xe31f:
|
|
282
|
+
break;
|
|
283
|
+
default:
|
|
284
|
+
accs.push(String.fromCodePoint(u));
|
|
285
|
+
}
|
|
274
286
|
}
|
|
275
287
|
for (let u = 0xe340; u <= 0xe367; u++) {
|
|
276
288
|
accs.push(String.fromCodePoint(u));
|
|
@@ -309,21 +321,22 @@ function genAccidentals() {
|
|
|
309
321
|
}
|
|
310
322
|
const accidentals = genAccidentals();
|
|
311
323
|
function cautionary(options) {
|
|
312
|
-
const staveCount =
|
|
324
|
+
const staveCount = 20;
|
|
325
|
+
const notesPerStave = 22;
|
|
313
326
|
const scale = 0.85;
|
|
314
|
-
const staveWidth =
|
|
327
|
+
const staveWidth = 900;
|
|
328
|
+
const staveHeight = 75;
|
|
315
329
|
let i = 0;
|
|
316
330
|
let j = 0;
|
|
317
|
-
const f = VexFlowTests.makeFactory(options, staveWidth + 10,
|
|
331
|
+
const f = VexFlowTests.makeFactory(options, staveWidth + 10, staveHeight * staveCount + 10);
|
|
318
332
|
f.getContext().scale(scale, scale);
|
|
319
333
|
const accids = Object.values(accidentals).filter((accid) => accid !== '{' && accid !== '}');
|
|
320
|
-
const mod = Math.round(accids.length / staveCount);
|
|
321
334
|
for (i = 0; i < staveCount; ++i) {
|
|
322
|
-
const stave = f.Stave({ x: 0, y: 10 +
|
|
335
|
+
const stave = f.Stave({ x: 0, y: 10 + (staveHeight / scale) * i, width: staveWidth / scale });
|
|
323
336
|
const score = f.EasyScore();
|
|
324
337
|
const rowMap = [];
|
|
325
|
-
for (j = 0; j <
|
|
326
|
-
rowMap.push(accids[j + i *
|
|
338
|
+
for (j = 0; j < notesPerStave && j + i * notesPerStave < accids.length; ++j) {
|
|
339
|
+
rowMap.push(accids[j + i * notesPerStave]);
|
|
327
340
|
}
|
|
328
341
|
const notes = rowMap.map((accidType) => f
|
|
329
342
|
.StaveNote({ keys: ['a/4'], duration: '4', stemDirection: Stem.UP })
|
|
@@ -435,8 +448,8 @@ function multiVoice(options) {
|
|
|
435
448
|
note1.addToModifierContext(modifierContext);
|
|
436
449
|
note2.addToModifierContext(modifierContext);
|
|
437
450
|
new TickContext().addTickable(note1).addTickable(note2).preFormat().setX(x);
|
|
438
|
-
note1.setContext(ctx).
|
|
439
|
-
note2.setContext(ctx).
|
|
451
|
+
note1.setContext(ctx).drawWithStyle();
|
|
452
|
+
note2.setContext(ctx).drawWithStyle();
|
|
440
453
|
Note.plotMetrics(ctx, note1, 180);
|
|
441
454
|
Note.plotMetrics(ctx, note2, 15);
|
|
442
455
|
}
|
|
@@ -444,7 +457,7 @@ function multiVoice(options) {
|
|
|
444
457
|
const accid = makeNewAccid(f);
|
|
445
458
|
const stave = f.Stave({ x: 10, y: 45, width: 420 });
|
|
446
459
|
const ctx = f.getContext();
|
|
447
|
-
stave.
|
|
460
|
+
stave.drawWithStyle();
|
|
448
461
|
let note1 = f
|
|
449
462
|
.StaveNote({ keys: ['c/4', 'e/4', 'a/4'], duration: '2', stemDirection: -1 })
|
|
450
463
|
.addModifier(accid('b'), 0)
|
|
@@ -79,7 +79,7 @@ function simple(options, contextBuilder) {
|
|
|
79
79
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
80
80
|
ctx.scale(1.5, 1.5);
|
|
81
81
|
ctx.font = '10pt Arial, sans-serif';
|
|
82
|
-
const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).
|
|
82
|
+
const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).drawWithStyle();
|
|
83
83
|
const notes = [
|
|
84
84
|
tabNote({
|
|
85
85
|
positions: [
|
|
@@ -99,7 +99,7 @@ function simple(options, contextBuilder) {
|
|
|
99
99
|
function standard(options, contextBuilder) {
|
|
100
100
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
101
101
|
ctx.scale(1.5, 1.5);
|
|
102
|
-
const stave = new Stave(10, 10, 450).addClef('treble').setContext(ctx).
|
|
102
|
+
const stave = new Stave(10, 10, 450).addClef('treble').setContext(ctx).drawWithStyle();
|
|
103
103
|
const annotation = (text) => new Annotation(text).setFont(Metrics.get('Annotation.fontFamily'), FONT_SIZE, 'normal', 'italic');
|
|
104
104
|
const notes = [
|
|
105
105
|
staveNote({ keys: ['c/4', 'e/4'], duration: 'h' }).addModifier(annotation('quiet'), 0),
|
|
@@ -111,7 +111,7 @@ function standard(options, contextBuilder) {
|
|
|
111
111
|
function styling(options, contextBuilder) {
|
|
112
112
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
113
113
|
ctx.scale(1.5, 1.5);
|
|
114
|
-
const stave = new Stave(10, 10, 450).addClef('treble').setContext(ctx).
|
|
114
|
+
const stave = new Stave(10, 10, 450).addClef('treble').setContext(ctx).drawWithStyle();
|
|
115
115
|
const annotation = (text, style) => new Annotation(text).setFont(Metrics.get('Annotation.fontFamily'), FONT_SIZE, 'normal', 'italic').setStyle(style);
|
|
116
116
|
const notes = [
|
|
117
117
|
staveNote({ keys: ['c/4', 'e/4'], duration: 'h' }).addModifier(annotation('quiet', { fillStyle: '#0F0' }), 0),
|
|
@@ -124,7 +124,7 @@ function harmonic(options, contextBuilder) {
|
|
|
124
124
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
125
125
|
ctx.scale(1.5, 1.5);
|
|
126
126
|
ctx.font = '10pt Arial';
|
|
127
|
-
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).
|
|
127
|
+
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).drawWithStyle();
|
|
128
128
|
const notes = [
|
|
129
129
|
tabNote({
|
|
130
130
|
positions: [
|
|
@@ -146,7 +146,7 @@ function harmonic(options, contextBuilder) {
|
|
|
146
146
|
function picking(options, contextBuilder) {
|
|
147
147
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
148
148
|
ctx.setFont(Metrics.get('fontFamily'), FONT_SIZE);
|
|
149
|
-
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).
|
|
149
|
+
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).drawWithStyle();
|
|
150
150
|
const annotation = (text) => new Annotation(text).setFont(Metrics.get('Annotation.fontFamily'), FONT_SIZE, 'normal', 'italic');
|
|
151
151
|
const notes = [
|
|
152
152
|
tabNote({
|
|
@@ -181,7 +181,7 @@ function picking(options, contextBuilder) {
|
|
|
181
181
|
}
|
|
182
182
|
function placement(options, contextBuilder) {
|
|
183
183
|
const ctx = contextBuilder(options.elementId, 750, 300);
|
|
184
|
-
const stave = new Stave(10, 50, 750).addClef('treble').setContext(ctx).
|
|
184
|
+
const stave = new Stave(10, 50, 750).addClef('treble').setContext(ctx).drawWithStyle();
|
|
185
185
|
const annotation = (text, fontSize, vj) => new Annotation(text).setFontSize(fontSize).setVerticalJustification(vj);
|
|
186
186
|
const notes = [
|
|
187
187
|
staveNote({ keys: ['e/4'], duration: 'q', stemDirection: Stem.DOWN })
|
|
@@ -245,7 +245,7 @@ function placement(options, contextBuilder) {
|
|
|
245
245
|
function bottom(options, contextBuilder) {
|
|
246
246
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
247
247
|
ctx.scale(1.5, 1.5);
|
|
248
|
-
const stave = new Stave(10, 10, 300).addClef('treble').setContext(ctx).
|
|
248
|
+
const stave = new Stave(10, 10, 300).addClef('treble').setContext(ctx).drawWithStyle();
|
|
249
249
|
const annotation = (text) => new Annotation(text).setFontSize(FONT_SIZE).setVerticalJustification(Annotation.VerticalJustify.BOTTOM);
|
|
250
250
|
const notes = [
|
|
251
251
|
staveNote({ keys: ['f/4'], duration: 'w' }).addModifier(annotation('F'), 0),
|
|
@@ -259,7 +259,7 @@ function bottom(options, contextBuilder) {
|
|
|
259
259
|
function bottomWithBeam(options, contextBuilder) {
|
|
260
260
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
261
261
|
ctx.scale(1.5, 1.5);
|
|
262
|
-
const stave = new Stave(10, 10, 300).addClef('treble').setContext(ctx).
|
|
262
|
+
const stave = new Stave(10, 10, 300).addClef('treble').setContext(ctx).drawWithStyle();
|
|
263
263
|
const notes = [
|
|
264
264
|
new StaveNote({ keys: ['a/3'], duration: '8' }).addModifier(new Annotation('good').setVerticalJustification(Annotation.VerticalJustify.BOTTOM)),
|
|
265
265
|
new StaveNote({ keys: ['g/3'], duration: '8' }).addModifier(new Annotation('even').setVerticalJustification(Annotation.VerticalJustify.BOTTOM)),
|
|
@@ -268,7 +268,7 @@ function bottomWithBeam(options, contextBuilder) {
|
|
|
268
268
|
];
|
|
269
269
|
const beam = new Beam(notes.slice(1));
|
|
270
270
|
Formatter.FormatAndDraw(ctx, stave, notes);
|
|
271
|
-
beam.setContext(ctx).
|
|
271
|
+
beam.setContext(ctx).drawWithStyle();
|
|
272
272
|
options.assert.ok(true, 'Bottom Annotation with Beams');
|
|
273
273
|
}
|
|
274
274
|
function justificationStemUp(options, contextBuilder) {
|
|
@@ -279,7 +279,7 @@ function justificationStemUp(options, contextBuilder) {
|
|
|
279
279
|
.setJustification(hJustification)
|
|
280
280
|
.setVerticalJustification(vJustification);
|
|
281
281
|
for (let v = 1; v <= 4; ++v) {
|
|
282
|
-
const stave = new Stave(10, (v - 1) * 150 + 40, 400).addClef('treble').setContext(ctx).
|
|
282
|
+
const stave = new Stave(10, (v - 1) * 150 + 40, 400).addClef('treble').setContext(ctx).drawWithStyle();
|
|
283
283
|
const notes = [
|
|
284
284
|
staveNote({ keys: ['c/3'], duration: 'q' }).addModifier(annotation('Text', 1, v), 0),
|
|
285
285
|
staveNote({ keys: ['c/4'], duration: 'q' }).addModifier(annotation('Text', 2, v), 0),
|
|
@@ -298,7 +298,7 @@ function justificationStemDown(options, contextBuilder) {
|
|
|
298
298
|
.setJustification(hJustification)
|
|
299
299
|
.setVerticalJustification(vJustification);
|
|
300
300
|
for (let v = 1; v <= 4; ++v) {
|
|
301
|
-
const stave = new Stave(10, (v - 1) * 150 + 40, 400).addClef('treble').setContext(ctx).
|
|
301
|
+
const stave = new Stave(10, (v - 1) * 150 + 40, 400).addClef('treble').setContext(ctx).drawWithStyle();
|
|
302
302
|
const notes = [
|
|
303
303
|
staveNote({ keys: ['c/3'], duration: 'q', stemDirection: -1 }).addModifier(annotation('Text', 1, v), 0),
|
|
304
304
|
staveNote({ keys: ['c/4', 'e/4', 'c/5'], duration: 'q', stemDirection: -1 }).addModifier(annotation('Text', 2, v), 0),
|
|
@@ -314,7 +314,7 @@ function tabNotes(options, contextBuilder) {
|
|
|
314
314
|
ctx.font = '10pt Arial, sans-serif';
|
|
315
315
|
const stave = new TabStave(10, 10, 550);
|
|
316
316
|
stave.setContext(ctx);
|
|
317
|
-
stave.
|
|
317
|
+
stave.drawWithStyle();
|
|
318
318
|
const specs = [
|
|
319
319
|
{
|
|
320
320
|
positions: [
|
|
@@ -53,7 +53,7 @@ function drawArticulations(options) {
|
|
|
53
53
|
.Stave({ x, y, width: nwidth + Stave.defaultPadding })
|
|
54
54
|
.setEndBarType(barline)
|
|
55
55
|
.setContext(ctx)
|
|
56
|
-
.
|
|
56
|
+
.drawWithStyle();
|
|
57
57
|
voices.forEach((voice) => voice.draw(ctx, stave));
|
|
58
58
|
return stave.getWidth();
|
|
59
59
|
};
|
|
@@ -121,7 +121,7 @@ function drawFermata(options) {
|
|
|
121
121
|
.Stave({ x, y, width: nwidth + Stave.defaultPadding })
|
|
122
122
|
.setEndBarType(barline)
|
|
123
123
|
.setContext(ctx)
|
|
124
|
-
.
|
|
124
|
+
.drawWithStyle();
|
|
125
125
|
voices.forEach((voice) => voice.draw(ctx, stave));
|
|
126
126
|
return stave.getWidth();
|
|
127
127
|
};
|
|
@@ -152,7 +152,7 @@ function drawFermata(options) {
|
|
|
152
152
|
function verticalPlacement(options, contextBuilder) {
|
|
153
153
|
const ctx = contextBuilder(options.elementId, 750, 300);
|
|
154
154
|
const staveNote = (noteStruct) => new StaveNote(noteStruct);
|
|
155
|
-
const stave = new Stave(10, 50, 750).addClef('treble').setContext(ctx).
|
|
155
|
+
const stave = new Stave(10, 50, 750).addClef('treble').setContext(ctx).drawWithStyle();
|
|
156
156
|
const notes = [
|
|
157
157
|
staveNote({ keys: ['f/4'], duration: 'q' })
|
|
158
158
|
.addModifier(new Articulation('a@u').setPosition(ModifierPosition.BELOW), 0)
|
|
@@ -215,7 +215,7 @@ function verticalPlacement(options, contextBuilder) {
|
|
|
215
215
|
function verticalPlacement2(options, contextBuilder) {
|
|
216
216
|
const ctx = contextBuilder(options.elementId, 750, 300);
|
|
217
217
|
const staveNote = (noteStruct) => new StaveNote(noteStruct);
|
|
218
|
-
const stave = new Stave(10, 50, 750).addClef('treble').setContext(ctx).
|
|
218
|
+
const stave = new Stave(10, 50, 750).addClef('treble').setContext(ctx).drawWithStyle();
|
|
219
219
|
const notes = [
|
|
220
220
|
staveNote({ keys: ['f/4'], duration: 'q' })
|
|
221
221
|
.addModifier(new Articulation(Glyphs.fermataBelow), 0)
|
|
@@ -275,7 +275,7 @@ function drawArticulations2(options) {
|
|
|
275
275
|
const f = VexFlowTests.makeFactory(options, 1500, 195);
|
|
276
276
|
const ctx = f.getContext();
|
|
277
277
|
ctx.scale(scale, scale);
|
|
278
|
-
const stave1 = new Stave(10, 50, 500).setContext(ctx).
|
|
278
|
+
const stave1 = new Stave(10, 50, 500).setContext(ctx).drawWithStyle();
|
|
279
279
|
const notesBar1 = [
|
|
280
280
|
f.StaveNote({ keys: ['c/4'], duration: '16', stemDirection: 1 }),
|
|
281
281
|
f.StaveNote({ keys: ['d/4'], duration: '16', stemDirection: 1 }),
|
|
@@ -305,9 +305,9 @@ function drawArticulations2(options) {
|
|
|
305
305
|
const beam1 = new Beam(notesBar1.slice(0, 8));
|
|
306
306
|
const beam2 = new Beam(notesBar1.slice(8, 16));
|
|
307
307
|
Formatter.FormatAndDraw(ctx, stave1, notesBar1);
|
|
308
|
-
beam1.setContext(ctx).
|
|
309
|
-
beam2.setContext(ctx).
|
|
310
|
-
const stave2 = new Stave(510, 50, 500).setContext(ctx).
|
|
308
|
+
beam1.setContext(ctx).drawWithStyle();
|
|
309
|
+
beam2.setContext(ctx).drawWithStyle();
|
|
310
|
+
const stave2 = new Stave(510, 50, 500).setContext(ctx).drawWithStyle();
|
|
311
311
|
const notesBar2 = [
|
|
312
312
|
f.StaveNote({ keys: ['f/3'], duration: '16', stemDirection: 1 }),
|
|
313
313
|
f.StaveNote({ keys: ['g/3'], duration: '16', stemDirection: 1 }),
|
|
@@ -336,15 +336,15 @@ function drawArticulations2(options) {
|
|
|
336
336
|
const beam3 = new Beam(notesBar2.slice(0, 8));
|
|
337
337
|
const beam4 = new Beam(notesBar2.slice(8, 16));
|
|
338
338
|
Formatter.FormatAndDraw(ctx, stave2, notesBar2);
|
|
339
|
-
beam3.setContext(ctx).
|
|
340
|
-
beam4.setContext(ctx).
|
|
341
|
-
const stave3 = new Stave(1010, 50, 100).setContext(ctx).
|
|
339
|
+
beam3.setContext(ctx).drawWithStyle();
|
|
340
|
+
beam4.setContext(ctx).drawWithStyle();
|
|
341
|
+
const stave3 = new Stave(1010, 50, 100).setContext(ctx).drawWithStyle();
|
|
342
342
|
const notesBar3 = [f.StaveNote({ keys: ['c/4'], duration: 'w', stemDirection: 1 })];
|
|
343
343
|
notesBar3[0].addModifier(new Articulation('a-').setPosition(3), 0);
|
|
344
344
|
notesBar3[0].addModifier(new Articulation('a>').setPosition(3), 0);
|
|
345
345
|
notesBar3[0].addModifier(new Articulation('a@a').setPosition(3), 0);
|
|
346
346
|
Formatter.FormatAndDraw(ctx, stave3, notesBar3);
|
|
347
|
-
const stave4 = new Stave(1110, 50, 250).setContext(ctx).
|
|
347
|
+
const stave4 = new Stave(1110, 50, 250).setContext(ctx).drawWithStyle();
|
|
348
348
|
const notesBar4 = [
|
|
349
349
|
f.StaveNote({ keys: ['c/5'], duration: 'q', stemDirection: -1 }),
|
|
350
350
|
f.StaveNote({ keys: ['a/5'], duration: 'q', stemDirection: -1 }),
|
|
@@ -365,7 +365,7 @@ function tabNotes(options, contextBuilder) {
|
|
|
365
365
|
ctx.font = '10pt ' + Metrics.get('fontFamily');
|
|
366
366
|
const stave = new TabStave(10, 10, 550);
|
|
367
367
|
stave.setContext(ctx);
|
|
368
|
-
stave.
|
|
368
|
+
stave.drawWithStyle();
|
|
369
369
|
const specs = [
|
|
370
370
|
{
|
|
371
371
|
positions: [
|
|
@@ -50,7 +50,7 @@ function simpleAuto(options) {
|
|
|
50
50
|
const beams = Beam.applyAndGetBeams(voice);
|
|
51
51
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
52
52
|
f.draw();
|
|
53
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
53
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
54
54
|
options.assert.ok(true, 'Auto Beaming Applicator Test');
|
|
55
55
|
}
|
|
56
56
|
function simpleAutoWithOverflowGroup(options) {
|
|
@@ -63,7 +63,7 @@ function simpleAutoWithOverflowGroup(options) {
|
|
|
63
63
|
const beams = Beam.applyAndGetBeams(voice);
|
|
64
64
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
65
65
|
f.draw();
|
|
66
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
66
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
67
67
|
options.assert.ok(true, 'Auto Beaming Applicator Test');
|
|
68
68
|
}
|
|
69
69
|
function evenGroupStemDirections(options) {
|
|
@@ -74,7 +74,7 @@ function evenGroupStemDirections(options) {
|
|
|
74
74
|
const beams = Beam.applyAndGetBeams(voice);
|
|
75
75
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
76
76
|
f.draw();
|
|
77
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
77
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
78
78
|
options.assert.equal(beams[0].getStemDirection(), Stem.UP);
|
|
79
79
|
options.assert.equal(beams[1].getStemDirection(), Stem.UP);
|
|
80
80
|
options.assert.equal(beams[2].getStemDirection(), Stem.UP);
|
|
@@ -98,7 +98,7 @@ function oddGroupStemDirections(options) {
|
|
|
98
98
|
options.assert.equal(beams[3].getStemDirection(), Stem.DOWN, 'Notes are equidistant from middle line');
|
|
99
99
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
100
100
|
f.draw();
|
|
101
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
101
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
102
102
|
options.assert.ok(true, 'Auto Beaming Applicator Test');
|
|
103
103
|
}
|
|
104
104
|
function oddBeamGroups(options) {
|
|
@@ -110,7 +110,7 @@ function oddBeamGroups(options) {
|
|
|
110
110
|
const beams = Beam.applyAndGetBeams(voice, undefined, groups);
|
|
111
111
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
112
112
|
f.draw();
|
|
113
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
113
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
114
114
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
115
115
|
}
|
|
116
116
|
function moreSimple0(options) {
|
|
@@ -121,7 +121,7 @@ function moreSimple0(options) {
|
|
|
121
121
|
const beams = Beam.applyAndGetBeams(voice);
|
|
122
122
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
123
123
|
f.draw();
|
|
124
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
124
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
125
125
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
126
126
|
}
|
|
127
127
|
function moreSimple1(options) {
|
|
@@ -132,7 +132,7 @@ function moreSimple1(options) {
|
|
|
132
132
|
const beams = Beam.applyAndGetBeams(voice);
|
|
133
133
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
134
134
|
f.draw();
|
|
135
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
135
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
136
136
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
137
137
|
}
|
|
138
138
|
function breakBeamsOnRests(options) {
|
|
@@ -145,7 +145,7 @@ function breakBeamsOnRests(options) {
|
|
|
145
145
|
});
|
|
146
146
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
147
147
|
f.draw();
|
|
148
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
148
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
149
149
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
150
150
|
}
|
|
151
151
|
function beamAcrossAllRestsWithStemlets(options) {
|
|
@@ -159,7 +159,7 @@ function beamAcrossAllRestsWithStemlets(options) {
|
|
|
159
159
|
});
|
|
160
160
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
161
161
|
f.draw();
|
|
162
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
162
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
163
163
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
164
164
|
}
|
|
165
165
|
function beamAcrossAllRests(options) {
|
|
@@ -172,7 +172,7 @@ function beamAcrossAllRests(options) {
|
|
|
172
172
|
});
|
|
173
173
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
174
174
|
f.draw();
|
|
175
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
175
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
176
176
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
177
177
|
}
|
|
178
178
|
function beamAcrossMiddleRests(options) {
|
|
@@ -186,7 +186,7 @@ function beamAcrossMiddleRests(options) {
|
|
|
186
186
|
});
|
|
187
187
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
188
188
|
f.draw();
|
|
189
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
189
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
190
190
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
191
191
|
}
|
|
192
192
|
function maintainStemDirections(options) {
|
|
@@ -205,7 +205,7 @@ function maintainStemDirections(options) {
|
|
|
205
205
|
});
|
|
206
206
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
207
207
|
f.draw();
|
|
208
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
208
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
209
209
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
210
210
|
}
|
|
211
211
|
function maintainStemDirectionsBeamAcrossRests(options) {
|
|
@@ -224,7 +224,7 @@ function maintainStemDirectionsBeamAcrossRests(options) {
|
|
|
224
224
|
});
|
|
225
225
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
226
226
|
f.draw();
|
|
227
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
227
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
228
228
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
229
229
|
}
|
|
230
230
|
function groupWithUnbeamableNote(options) {
|
|
@@ -239,7 +239,7 @@ function groupWithUnbeamableNote(options) {
|
|
|
239
239
|
});
|
|
240
240
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
241
241
|
f.draw();
|
|
242
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
242
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
243
243
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
244
244
|
}
|
|
245
245
|
function groupWithUnbeamableNote1(options) {
|
|
@@ -254,7 +254,7 @@ function groupWithUnbeamableNote1(options) {
|
|
|
254
254
|
});
|
|
255
255
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
256
256
|
f.draw();
|
|
257
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
257
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
258
258
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
259
259
|
}
|
|
260
260
|
function autoOddBeamGroups(options) {
|
|
@@ -276,7 +276,7 @@ function autoOddBeamGroups(options) {
|
|
|
276
276
|
f.Formatter().formatToStave([voice1], stave1).formatToStave([voice2], stave2).formatToStave([voice3], stave3);
|
|
277
277
|
Stave.formatBegModifiers([stave1, stave2, stave3]);
|
|
278
278
|
f.draw();
|
|
279
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
279
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
280
280
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
281
281
|
}
|
|
282
282
|
function customBeamGroups(options) {
|
|
@@ -299,7 +299,7 @@ function customBeamGroups(options) {
|
|
|
299
299
|
f.Formatter().formatToStave([voice1], stave1).formatToStave([voice2], stave2).formatToStave([voice3], stave3);
|
|
300
300
|
Stave.formatBegModifiers([stave1, stave2, stave3]);
|
|
301
301
|
f.draw();
|
|
302
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
302
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
303
303
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
304
304
|
}
|
|
305
305
|
function createShortcuts(score) {
|
|
@@ -321,7 +321,7 @@ function simpleTuplets(options) {
|
|
|
321
321
|
const beams = Beam.applyAndGetBeams(voice);
|
|
322
322
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
323
323
|
f.draw();
|
|
324
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
324
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
325
325
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
326
326
|
}
|
|
327
327
|
function moreSimpleTuplets(options) {
|
|
@@ -333,7 +333,7 @@ function moreSimpleTuplets(options) {
|
|
|
333
333
|
const beams = Beam.applyAndGetBeams(voice);
|
|
334
334
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
335
335
|
f.draw();
|
|
336
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
336
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
337
337
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
338
338
|
}
|
|
339
339
|
function moreBeaming(options) {
|
|
@@ -344,7 +344,7 @@ function moreBeaming(options) {
|
|
|
344
344
|
const beams = Beam.applyAndGetBeams(voice, undefined, Beam.getDefaultBeamGroups('9/8'));
|
|
345
345
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
346
346
|
f.draw();
|
|
347
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
347
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
348
348
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
349
349
|
}
|
|
350
350
|
function beamingWithSeveralGroups1(options) {
|
|
@@ -355,7 +355,7 @@ function beamingWithSeveralGroups1(options) {
|
|
|
355
355
|
const beams = Beam.applyAndGetBeams(voice, undefined, [new Fraction(3, 8), new Fraction(3, 8), new Fraction(2, 8)]);
|
|
356
356
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
357
357
|
f.draw();
|
|
358
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
358
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
359
359
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
360
360
|
}
|
|
361
361
|
function beamingWithSeveralGroupsOverflow(options) {
|
|
@@ -366,7 +366,7 @@ function beamingWithSeveralGroupsOverflow(options) {
|
|
|
366
366
|
const beams = Beam.applyAndGetBeams(voice, undefined, [new Fraction(3, 8), new Fraction(3, 8), new Fraction(2, 8)]);
|
|
367
367
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
368
368
|
f.draw();
|
|
369
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
369
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
370
370
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
371
371
|
}
|
|
372
372
|
function beamingWithSeveralGroupsOverflow2(options) {
|
|
@@ -379,7 +379,7 @@ function beamingWithSeveralGroupsOverflow2(options) {
|
|
|
379
379
|
const beams = Beam.applyAndGetBeams(voice, undefined, [new Fraction(3, 8), new Fraction(2, 8), new Fraction(3, 8)]);
|
|
380
380
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
381
381
|
f.draw();
|
|
382
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
382
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
383
383
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
384
384
|
}
|
|
385
385
|
function beamingWithSeveralGroupsOverflow3(options) {
|
|
@@ -390,7 +390,7 @@ function beamingWithSeveralGroupsOverflow3(options) {
|
|
|
390
390
|
const beams = Beam.applyAndGetBeams(voice, undefined, [new Fraction(3, 8), new Fraction(2, 8), new Fraction(3, 8)]);
|
|
391
391
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
392
392
|
f.draw();
|
|
393
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
393
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
394
394
|
options.assert.ok(true, 'Auto Beam Applicator Test');
|
|
395
395
|
}
|
|
396
396
|
function secondaryBreaks1(options) {
|
|
@@ -406,7 +406,7 @@ function secondaryBreaks1(options) {
|
|
|
406
406
|
const beams = Beam.generateBeams(voice.getTickables(), { secondaryBreaks: '8' });
|
|
407
407
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
408
408
|
f.draw();
|
|
409
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
409
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
410
410
|
options.assert.ok(true, 'Duration-Based Secondary Breaks Test');
|
|
411
411
|
}
|
|
412
412
|
function secondaryBreaks2(options) {
|
|
@@ -426,7 +426,7 @@ function secondaryBreaks2(options) {
|
|
|
426
426
|
const beams = Beam.generateBeams(voice.getTickables(), { secondaryBreaks: '8' });
|
|
427
427
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
428
428
|
f.draw();
|
|
429
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
429
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
430
430
|
options.assert.ok(true, 'Duration-Based Secondary Breaks Test');
|
|
431
431
|
}
|
|
432
432
|
function flatBeamsUp(options) {
|
|
@@ -446,7 +446,7 @@ function flatBeamsUp(options) {
|
|
|
446
446
|
});
|
|
447
447
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
448
448
|
f.draw();
|
|
449
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
449
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
450
450
|
options.assert.ok(true, 'Flat Beams Up Test');
|
|
451
451
|
}
|
|
452
452
|
function flatBeamsDown(options) {
|
|
@@ -460,7 +460,7 @@ function flatBeamsDown(options) {
|
|
|
460
460
|
});
|
|
461
461
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
462
462
|
f.draw();
|
|
463
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
463
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
464
464
|
options.assert.ok(true, 'Flat Beams Down Test');
|
|
465
465
|
}
|
|
466
466
|
function flatBeamsMixed(options) {
|
|
@@ -471,7 +471,7 @@ function flatBeamsMixed(options) {
|
|
|
471
471
|
const beams = Beam.generateBeams(voice.getTickables(), { flatBeams: true });
|
|
472
472
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
473
473
|
f.draw();
|
|
474
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
474
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
475
475
|
options.assert.ok(true, 'Flat Beams Mixed Direction Test');
|
|
476
476
|
}
|
|
477
477
|
function flatBeamsUpUniform(options) {
|
|
@@ -490,7 +490,7 @@ function flatBeamsUpUniform(options) {
|
|
|
490
490
|
});
|
|
491
491
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
492
492
|
f.draw();
|
|
493
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
493
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
494
494
|
options.assert.ok(true, 'Flat Beams Up (uniform) Test');
|
|
495
495
|
}
|
|
496
496
|
function flatBeamsDownUniform(options) {
|
|
@@ -505,7 +505,7 @@ function flatBeamsDownUniform(options) {
|
|
|
505
505
|
});
|
|
506
506
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
507
507
|
f.draw();
|
|
508
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
508
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
509
509
|
options.assert.ok(true, 'Flat Beams Down (uniform) Test');
|
|
510
510
|
}
|
|
511
511
|
function flatBeamsUpBounds(options) {
|
|
@@ -524,7 +524,7 @@ function flatBeamsUpBounds(options) {
|
|
|
524
524
|
});
|
|
525
525
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
526
526
|
f.draw();
|
|
527
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
527
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
528
528
|
options.assert.ok(true, 'Flat Beams Up (uniform) Test');
|
|
529
529
|
}
|
|
530
530
|
function flatBeamsDownBounds(options) {
|
|
@@ -544,7 +544,7 @@ function flatBeamsDownBounds(options) {
|
|
|
544
544
|
});
|
|
545
545
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
546
546
|
f.draw();
|
|
547
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
547
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
548
548
|
options.assert.ok(true, 'Flat Beams Down (uniform) Test');
|
|
549
549
|
}
|
|
550
550
|
VexFlowTests.register(AutoBeamFormattingTests);
|
|
@@ -481,7 +481,7 @@ function autoTabBeams(options) {
|
|
|
481
481
|
const beams = Beam.applyAndGetBeams(voice, -1);
|
|
482
482
|
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
483
483
|
f.draw();
|
|
484
|
-
beams.forEach((beam) => beam.setContext(f.getContext()).
|
|
484
|
+
beams.forEach((beam) => beam.setContext(f.getContext()).drawWithStyle());
|
|
485
485
|
options.assert.ok(true, 'All objects have been drawn');
|
|
486
486
|
}
|
|
487
487
|
function tabBeamsAutoStem(options) {
|
|
@@ -24,7 +24,7 @@ function doubleBends(options, contextBuilder) {
|
|
|
24
24
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
25
25
|
ctx.scale(1.5, 1.5);
|
|
26
26
|
ctx.font = '10pt Arial';
|
|
27
|
-
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).
|
|
27
|
+
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).drawWithStyle();
|
|
28
28
|
const notes = [
|
|
29
29
|
note({
|
|
30
30
|
positions: [
|
|
@@ -58,7 +58,7 @@ function doubleBendsWithRelease(options, contextBuilder) {
|
|
|
58
58
|
ctx.scale(1.0, 1.0);
|
|
59
59
|
ctx.setBackgroundFillStyle('#FFF');
|
|
60
60
|
ctx.setFont('Arial', VexFlowTests.Font.size);
|
|
61
|
-
const stave = new TabStave(10, 10, 550).addClef('tab').setContext(ctx).
|
|
61
|
+
const stave = new TabStave(10, 10, 550).addClef('tab').setContext(ctx).drawWithStyle();
|
|
62
62
|
const notes = [
|
|
63
63
|
note({
|
|
64
64
|
positions: [
|
|
@@ -112,7 +112,7 @@ function reverseBends(options, contextBuilder) {
|
|
|
112
112
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
113
113
|
ctx.scale(1.5, 1.5);
|
|
114
114
|
ctx.setFont('10pt Arial');
|
|
115
|
-
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).
|
|
115
|
+
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).drawWithStyle();
|
|
116
116
|
const notes = [
|
|
117
117
|
note({
|
|
118
118
|
positions: [
|
|
@@ -146,7 +146,7 @@ function reverseBends(options, contextBuilder) {
|
|
|
146
146
|
.addTickable(note)
|
|
147
147
|
.preFormat()
|
|
148
148
|
.setX(75 * i);
|
|
149
|
-
note.setStave(stave).setContext(ctx).
|
|
149
|
+
note.setStave(stave).setContext(ctx).drawWithStyle();
|
|
150
150
|
Note.plotMetrics(ctx, note, 140);
|
|
151
151
|
options.assert.ok(true, 'Bend ' + i);
|
|
152
152
|
}
|
|
@@ -155,7 +155,7 @@ function bendPhrase(options, contextBuilder) {
|
|
|
155
155
|
const ctx = contextBuilder(options.elementId, 500, 240);
|
|
156
156
|
ctx.scale(1.5, 1.5);
|
|
157
157
|
ctx.font = Metrics.get('Bend.fontSize') + Metrics.get('Bend.fontFamily');
|
|
158
|
-
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).
|
|
158
|
+
const stave = new TabStave(10, 10, 450).addClef('tab').setContext(ctx).drawWithStyle();
|
|
159
159
|
const phrase1 = [
|
|
160
160
|
{ type: Bend.UP, text: 'Full' },
|
|
161
161
|
{ type: Bend.DOWN, text: 'Monstrous' },
|
|
@@ -177,7 +177,7 @@ function bendPhrase(options, contextBuilder) {
|
|
|
177
177
|
.addTickable(note)
|
|
178
178
|
.preFormat()
|
|
179
179
|
.setX(75 * i);
|
|
180
|
-
note.setStave(stave).setContext(ctx).
|
|
180
|
+
note.setStave(stave).setContext(ctx).drawWithStyle();
|
|
181
181
|
Note.plotMetrics(ctx, note, 140);
|
|
182
182
|
options.assert.ok(true, 'Bend ' + i);
|
|
183
183
|
}
|
|
@@ -187,7 +187,7 @@ function whackoBends(options, contextBuilder) {
|
|
|
187
187
|
ctx.scale(1.0, 1.0);
|
|
188
188
|
ctx.setBackgroundFillStyle('#FFF');
|
|
189
189
|
ctx.setFont('Arial', VexFlowTests.Font.size);
|
|
190
|
-
const stave = new TabStave(10, 10, 350).addClef('tab').setContext(ctx).
|
|
190
|
+
const stave = new TabStave(10, 10, 350).addClef('tab').setContext(ctx).drawWithStyle();
|
|
191
191
|
const phrase1 = [
|
|
192
192
|
{ type: Bend.UP, text: 'Full' },
|
|
193
193
|
{ type: Bend.DOWN, text: '' },
|