vexflow 4.0.1-alpha.2 → 4.0.1-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/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 +135 -73
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +123 -44
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow-font-bravura.js +1 -1
- package/build/cjs/vexflow-font-bravura.js.map +1 -1
- package/build/cjs/vexflow-font-gonville.js +1 -1
- package/build/cjs/vexflow-font-gonville.js.map +1 -1
- package/build/cjs/vexflow-font-petaluma.js +1 -1
- package/build/cjs/vexflow-font-petaluma.js.map +1 -1
- package/build/cjs/vexflow-gonville.js +2 -2
- package/build/cjs/vexflow-gonville.js.map +1 -1
- package/build/cjs/vexflow-petaluma.js +2 -2
- package/build/cjs/vexflow-petaluma.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 +1 -1
- package/build/esm/src/beam.js +4 -0
- package/build/esm/src/fonts/bravura_metrics.js +8 -5
- package/build/esm/src/fonts/gonville_metrics.js +8 -2
- package/build/esm/src/fonts/petaluma_metrics.js +8 -5
- package/build/esm/src/gracenote.js +2 -0
- package/build/esm/src/stavenote.js +15 -5
- package/build/esm/src/staverepetition.js +8 -8
- package/build/esm/src/stavetie.js +2 -0
- package/build/esm/src/stemmablenote.js +4 -2
- package/build/esm/src/tables.js +36 -0
- package/build/esm/src/tabnote.js +12 -9
- package/build/esm/src/version.js +3 -3
- package/build/esm/tests/articulation_tests.js +11 -24
- package/build/esm/tests/ornament_tests.js +0 -1
- package/build/types/entry/vexflow-font-bravura.d.ts +8 -5
- package/build/types/entry/vexflow-font-gonville.d.ts +8 -2
- package/build/types/entry/vexflow-font-petaluma.d.ts +8 -5
- package/build/types/src/fonts/bravura_metrics.d.ts +8 -5
- package/build/types/src/fonts/gonville_metrics.d.ts +8 -2
- package/build/types/src/fonts/petaluma_metrics.d.ts +8 -5
- package/build/types/src/glyph.d.ts +4 -0
- package/build/types/src/stavenote.d.ts +2 -0
- package/build/types/src/stem.d.ts +4 -1
- package/build/types/src/stemmablenote.d.ts +4 -1
- package/build/types/src/tabnote.d.ts +4 -1
- package/package.json +1 -1
- package/src/accidental.ts +1 -1
- package/src/beam.ts +4 -0
- package/src/fonts/bravura_metrics.ts +8 -5
- package/src/fonts/gonville_metrics.ts +8 -2
- package/src/fonts/petaluma_metrics.ts +8 -5
- package/src/glyph.ts +4 -0
- package/src/gracenote.ts +4 -1
- package/src/stavenote.ts +17 -5
- package/src/staverepetition.ts +8 -8
- package/src/stavetie.ts +8 -0
- package/src/stem.ts +1 -1
- package/src/stemmablenote.ts +6 -4
- package/src/tables.ts +36 -0
- package/src/tabnote.ts +16 -13
- package/build/esm/src/publicpath.js +0 -1
- package/build/types/src/publicpath.d.ts +0 -0
- package/src/publicpath.ts +0 -0
|
@@ -47,7 +47,7 @@ export class Accidental extends Modifier {
|
|
|
47
47
|
const props = note.getKeyProps()[index];
|
|
48
48
|
if (note !== prevNote) {
|
|
49
49
|
for (let n = 0; n < note.keys.length; ++n) {
|
|
50
|
-
shiftL = Math.max(note.getLeftDisplacedHeadPx(), shiftL);
|
|
50
|
+
shiftL = Math.max(note.getLeftDisplacedHeadPx() - note.getXShift(), shiftL);
|
|
51
51
|
}
|
|
52
52
|
prevNote = note;
|
|
53
53
|
}
|
package/build/esm/src/beam.js
CHANGED
|
@@ -562,7 +562,9 @@ export class Beam extends Element {
|
|
|
562
562
|
this.notes.forEach((note) => {
|
|
563
563
|
const stem = note.getStem();
|
|
564
564
|
if (stem) {
|
|
565
|
+
ctx.openGroup('stem', note.getAttribute('id') + '-stem');
|
|
565
566
|
stem.setContext(ctx).draw();
|
|
567
|
+
ctx.closeGroup();
|
|
566
568
|
}
|
|
567
569
|
}, this);
|
|
568
570
|
}
|
|
@@ -582,6 +584,7 @@ export class Beam extends Element {
|
|
|
582
584
|
const lastBeamX = beam_line.end;
|
|
583
585
|
if (lastBeamX) {
|
|
584
586
|
const lastBeamY = this.getSlopeY(lastBeamX, firstStemX, beamY, this.slope);
|
|
587
|
+
this.setAttribute('el', ctx.openGroup('beam'));
|
|
585
588
|
ctx.beginPath();
|
|
586
589
|
ctx.moveTo(startBeamX, startBeamY);
|
|
587
590
|
ctx.lineTo(startBeamX, startBeamY + beamThickness);
|
|
@@ -589,6 +592,7 @@ export class Beam extends Element {
|
|
|
589
592
|
ctx.lineTo(lastBeamX + 1, lastBeamY);
|
|
590
593
|
ctx.closePath();
|
|
591
594
|
ctx.fill();
|
|
595
|
+
ctx.closeGroup();
|
|
592
596
|
}
|
|
593
597
|
else {
|
|
594
598
|
throw new RuntimeError('NoLastBeamX', 'lastBeamX undefined.');
|
|
@@ -124,11 +124,17 @@ export const BravuraMetrics = {
|
|
|
124
124
|
},
|
|
125
125
|
},
|
|
126
126
|
staveRepetition: {
|
|
127
|
-
|
|
127
|
+
symbolText: {
|
|
128
|
+
offsetX: 12,
|
|
128
129
|
offsetY: 25,
|
|
129
|
-
offsetSymbol: 12,
|
|
130
130
|
spacing: 5,
|
|
131
131
|
},
|
|
132
|
+
coda: {
|
|
133
|
+
offsetY: 25,
|
|
134
|
+
},
|
|
135
|
+
segno: {
|
|
136
|
+
offsetY: 10,
|
|
137
|
+
},
|
|
132
138
|
},
|
|
133
139
|
stem: {
|
|
134
140
|
heightAdjustmentForFlag: -3,
|
|
@@ -182,9 +188,6 @@ export const BravuraMetrics = {
|
|
|
182
188
|
},
|
|
183
189
|
flag: {
|
|
184
190
|
shiftX: -0.75,
|
|
185
|
-
tabStem: {
|
|
186
|
-
shiftX: -1.75,
|
|
187
|
-
},
|
|
188
191
|
staveTempo: {
|
|
189
192
|
shiftX: -1,
|
|
190
193
|
},
|
|
@@ -114,11 +114,17 @@ export const GonvilleMetrics = {
|
|
|
114
114
|
},
|
|
115
115
|
},
|
|
116
116
|
staveRepetition: {
|
|
117
|
-
|
|
117
|
+
symbolText: {
|
|
118
|
+
offsetX: 12,
|
|
118
119
|
offsetY: 25,
|
|
119
|
-
offsetSymbol: 12,
|
|
120
120
|
spacing: 5,
|
|
121
121
|
},
|
|
122
|
+
coda: {
|
|
123
|
+
offsetY: 25,
|
|
124
|
+
},
|
|
125
|
+
segno: {
|
|
126
|
+
offsetY: 0,
|
|
127
|
+
},
|
|
122
128
|
},
|
|
123
129
|
stem: {
|
|
124
130
|
heightAdjustmentForFlag: -3,
|
|
@@ -124,11 +124,17 @@ export const PetalumaMetrics = {
|
|
|
124
124
|
},
|
|
125
125
|
},
|
|
126
126
|
staveRepetition: {
|
|
127
|
-
|
|
127
|
+
symbolText: {
|
|
128
|
+
offsetX: 12,
|
|
128
129
|
offsetY: 25,
|
|
129
|
-
offsetSymbol: 12,
|
|
130
130
|
spacing: 5,
|
|
131
131
|
},
|
|
132
|
+
coda: {
|
|
133
|
+
offsetY: 25,
|
|
134
|
+
},
|
|
135
|
+
segno: {
|
|
136
|
+
offsetY: 10,
|
|
137
|
+
},
|
|
132
138
|
},
|
|
133
139
|
noteHead: {
|
|
134
140
|
displaced: {
|
|
@@ -211,9 +217,6 @@ export const PetalumaMetrics = {
|
|
|
211
217
|
flag128thDown: {
|
|
212
218
|
shiftX: -1.2,
|
|
213
219
|
},
|
|
214
|
-
tabStem: {
|
|
215
|
-
shiftX: -1.75,
|
|
216
|
-
},
|
|
217
220
|
staveTempo: {
|
|
218
221
|
shiftX: -1,
|
|
219
222
|
},
|
|
@@ -63,8 +63,10 @@ export class GraceNote extends StaveNote {
|
|
|
63
63
|
let y = stem_direction === Stem.DOWN
|
|
64
64
|
? noteHeadBounds.y_top - noteStemHeight
|
|
65
65
|
: noteHeadBounds.y_bottom - noteStemHeight;
|
|
66
|
+
const defaultStemExtention = stem_direction === Stem.DOWN ? this.glyph.stem_down_extension : this.glyph.stem_up_extension;
|
|
66
67
|
let defaultOffsetY = Tables.STEM_HEIGHT;
|
|
67
68
|
defaultOffsetY -= defaultOffsetY / 2.8;
|
|
69
|
+
defaultOffsetY += defaultStemExtention;
|
|
68
70
|
y += defaultOffsetY * staveNoteScale * stem_direction;
|
|
69
71
|
const offsets = stem_direction === Stem.UP
|
|
70
72
|
? {
|
|
@@ -688,7 +688,7 @@ export class StaveNote extends StemmableNote {
|
|
|
688
688
|
return hasStem && hasFlag && hasNoBeam;
|
|
689
689
|
}
|
|
690
690
|
drawFlag() {
|
|
691
|
-
var _a;
|
|
691
|
+
var _a, _b, _c, _d, _e;
|
|
692
692
|
const ctx = this.checkContext();
|
|
693
693
|
if (!ctx) {
|
|
694
694
|
throw new RuntimeError('NoCanvasContext', "Can't draw without a canvas context.");
|
|
@@ -697,15 +697,22 @@ export class StaveNote extends StemmableNote {
|
|
|
697
697
|
const { y_top, y_bottom } = this.getNoteHeadBounds();
|
|
698
698
|
const noteStemHeight = this.stem.getHeight();
|
|
699
699
|
const flagX = this.getStemX();
|
|
700
|
-
const extension = this.flag !== undefined ? this.flag.checkMetrics().y_shift : 0;
|
|
701
700
|
const flagY = this.getStemDirection() === Stem.DOWN
|
|
702
701
|
?
|
|
703
|
-
y_top -
|
|
702
|
+
y_top -
|
|
703
|
+
noteStemHeight +
|
|
704
|
+
2 -
|
|
705
|
+
(this.glyph ? this.glyph.stem_down_extension : 0) * this.getStaveNoteScale() -
|
|
706
|
+
((_b = (_a = this.flag) === null || _a === void 0 ? void 0 : _a.getMetrics().y_shift) !== null && _b !== void 0 ? _b : 0) * (1 - this.getStaveNoteScale())
|
|
704
707
|
:
|
|
705
|
-
y_bottom -
|
|
708
|
+
y_bottom -
|
|
709
|
+
noteStemHeight -
|
|
710
|
+
2 +
|
|
711
|
+
(this.glyph ? this.glyph.stem_up_extension : 0) * this.getStaveNoteScale() -
|
|
712
|
+
((_d = (_c = this.flag) === null || _c === void 0 ? void 0 : _c.getMetrics().y_shift) !== null && _d !== void 0 ? _d : 0) * (1 - this.getStaveNoteScale());
|
|
706
713
|
ctx.openGroup('flag', undefined, { pointerBBox: true });
|
|
707
714
|
this.applyStyle(ctx, this.getFlagStyle());
|
|
708
|
-
(
|
|
715
|
+
(_e = this.flag) === null || _e === void 0 ? void 0 : _e.render(ctx, flagX, flagY);
|
|
709
716
|
this.restoreStyle(ctx, this.getFlagStyle());
|
|
710
717
|
ctx.closeGroup();
|
|
711
718
|
}
|
|
@@ -731,6 +738,9 @@ export class StaveNote extends StemmableNote {
|
|
|
731
738
|
(_a = this.stem) === null || _a === void 0 ? void 0 : _a.setContext(ctx).draw();
|
|
732
739
|
ctx.closeGroup();
|
|
733
740
|
}
|
|
741
|
+
getStaveNoteScale() {
|
|
742
|
+
return 1.0;
|
|
743
|
+
}
|
|
734
744
|
getStemExtension() {
|
|
735
745
|
const super_stem_extension = super.getStemExtension();
|
|
736
746
|
if (!this.glyph.stem) {
|
|
@@ -68,12 +68,12 @@ export class Repetition extends StaveModifier {
|
|
|
68
68
|
}
|
|
69
69
|
drawCodaFixed(stave, x) {
|
|
70
70
|
const y = stave.getYForTopText(stave.getNumLines()) + this.y_shift;
|
|
71
|
-
Glyph.renderGlyph(stave.checkContext(), this.x + x + this.x_shift, y + Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
71
|
+
Glyph.renderGlyph(stave.checkContext(), this.x + x + this.x_shift, y + Tables.currentMusicFont().lookupMetric('staveRepetition.coda.offsetY'), 40, 'coda', { category: 'coda' });
|
|
72
72
|
return this;
|
|
73
73
|
}
|
|
74
74
|
drawSignoFixed(stave, x) {
|
|
75
75
|
const y = stave.getYForTopText(stave.getNumLines()) + this.y_shift;
|
|
76
|
-
Glyph.renderGlyph(stave.checkContext(), this.x + x + this.x_shift, y + Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
76
|
+
Glyph.renderGlyph(stave.checkContext(), this.x + x + this.x_shift, y + Tables.currentMusicFont().lookupMetric('staveRepetition.segno.offsetY'), 30, 'segno', { category: 'segno' });
|
|
77
77
|
return this;
|
|
78
78
|
}
|
|
79
79
|
drawSymbolText(stave, x, text, draw_coda) {
|
|
@@ -89,7 +89,7 @@ export class Repetition extends StaveModifier {
|
|
|
89
89
|
symbol_x =
|
|
90
90
|
text_x +
|
|
91
91
|
ctx.measureText(text).width +
|
|
92
|
-
Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
92
|
+
Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.offsetX');
|
|
93
93
|
break;
|
|
94
94
|
case Repetition.type.DC:
|
|
95
95
|
case Repetition.type.DC_AL_FINE:
|
|
@@ -101,7 +101,7 @@ export class Repetition extends StaveModifier {
|
|
|
101
101
|
x +
|
|
102
102
|
this.x_shift +
|
|
103
103
|
stave.getWidth() -
|
|
104
|
-
Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
104
|
+
Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.spacing') -
|
|
105
105
|
modifierWidth -
|
|
106
106
|
ctx.measureText(text).width;
|
|
107
107
|
break;
|
|
@@ -111,19 +111,19 @@ export class Repetition extends StaveModifier {
|
|
|
111
111
|
x +
|
|
112
112
|
this.x_shift +
|
|
113
113
|
stave.getWidth() -
|
|
114
|
-
Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
114
|
+
Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.spacing') -
|
|
115
115
|
modifierWidth -
|
|
116
116
|
ctx.measureText(text).width -
|
|
117
|
-
Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
117
|
+
Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.offsetX');
|
|
118
118
|
symbol_x =
|
|
119
119
|
text_x +
|
|
120
120
|
ctx.measureText(text).width +
|
|
121
|
-
Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
121
|
+
Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.offsetX');
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
const y = stave.getYForTopText(stave.getNumLines()) +
|
|
125
125
|
this.y_shift +
|
|
126
|
-
Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
126
|
+
Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.offsetY');
|
|
127
127
|
if (draw_coda) {
|
|
128
128
|
Glyph.renderGlyph(ctx, symbol_x, y, 40, 'coda', { category: 'coda' });
|
|
129
129
|
}
|
|
@@ -67,12 +67,14 @@ export class StaveTie extends Element {
|
|
|
67
67
|
}
|
|
68
68
|
const top_cp_y = (first_y_px + last_y_px) / 2 + cp1 * params.direction;
|
|
69
69
|
const bottom_cp_y = (first_y_px + last_y_px) / 2 + cp2 * params.direction;
|
|
70
|
+
this.setAttribute('el', ctx.openGroup('stavetie'));
|
|
70
71
|
ctx.beginPath();
|
|
71
72
|
ctx.moveTo(params.first_x_px + first_x_shift, first_y_px);
|
|
72
73
|
ctx.quadraticCurveTo(cp_x, top_cp_y, params.last_x_px + last_x_shift, last_y_px);
|
|
73
74
|
ctx.quadraticCurveTo(cp_x, bottom_cp_y, params.first_x_px + first_x_shift, first_y_px);
|
|
74
75
|
ctx.closePath();
|
|
75
76
|
ctx.fill();
|
|
77
|
+
ctx.closeGroup();
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
renderText(first_x_px, last_x_px) {
|
|
@@ -136,8 +136,10 @@ export class StemmableNote extends Note {
|
|
|
136
136
|
if (this.beam) {
|
|
137
137
|
return glyph.stem_beam_extension;
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
if (glyph) {
|
|
140
|
+
return this.getStemDirection() === Stem.UP ? glyph.stem_up_extension : glyph.stem_down_extension;
|
|
141
|
+
}
|
|
142
|
+
return 0;
|
|
141
143
|
}
|
|
142
144
|
setStemLength(height) {
|
|
143
145
|
this.stem_extension_override = height - Stem.HEIGHT;
|
package/build/esm/src/tables.js
CHANGED
|
@@ -715,6 +715,10 @@ const durationCodes = {
|
|
|
715
715
|
stem: false,
|
|
716
716
|
stem_offset: 0,
|
|
717
717
|
flag: false,
|
|
718
|
+
stem_up_extension: -Tables.STEM_HEIGHT,
|
|
719
|
+
stem_down_extension: -Tables.STEM_HEIGHT,
|
|
720
|
+
tabnote_stem_up_extension: -Tables.STEM_HEIGHT,
|
|
721
|
+
tabnote_stem_down_extension: -Tables.STEM_HEIGHT,
|
|
718
722
|
dot_shiftY: 0,
|
|
719
723
|
line_above: 0,
|
|
720
724
|
line_below: 0,
|
|
@@ -750,6 +754,10 @@ const durationCodes = {
|
|
|
750
754
|
stem: false,
|
|
751
755
|
stem_offset: 0,
|
|
752
756
|
flag: false,
|
|
757
|
+
stem_up_extension: -Tables.STEM_HEIGHT,
|
|
758
|
+
stem_down_extension: -Tables.STEM_HEIGHT,
|
|
759
|
+
tabnote_stem_up_extension: -Tables.STEM_HEIGHT,
|
|
760
|
+
tabnote_stem_down_extension: -Tables.STEM_HEIGHT,
|
|
753
761
|
dot_shiftY: 0,
|
|
754
762
|
line_above: 0,
|
|
755
763
|
line_below: 0,
|
|
@@ -785,6 +793,10 @@ const durationCodes = {
|
|
|
785
793
|
stem: true,
|
|
786
794
|
stem_offset: 0,
|
|
787
795
|
flag: false,
|
|
796
|
+
stem_up_extension: 0,
|
|
797
|
+
stem_down_extension: 0,
|
|
798
|
+
tabnote_stem_up_extension: 0,
|
|
799
|
+
tabnote_stem_down_extension: 0,
|
|
788
800
|
dot_shiftY: 0,
|
|
789
801
|
line_above: 0,
|
|
790
802
|
line_below: 0,
|
|
@@ -821,6 +833,10 @@ const durationCodes = {
|
|
|
821
833
|
stem: true,
|
|
822
834
|
stem_offset: 0,
|
|
823
835
|
flag: false,
|
|
836
|
+
stem_up_extension: 0,
|
|
837
|
+
stem_down_extension: 0,
|
|
838
|
+
tabnote_stem_up_extension: 0,
|
|
839
|
+
tabnote_stem_down_extension: 0,
|
|
824
840
|
dot_shiftY: 0,
|
|
825
841
|
line_above: 0,
|
|
826
842
|
line_below: 0,
|
|
@@ -862,6 +878,10 @@ const durationCodes = {
|
|
|
862
878
|
stem_beam_extension: 0,
|
|
863
879
|
code_flag_upstem: 'flag8thUp',
|
|
864
880
|
code_flag_downstem: 'flag8thDown',
|
|
881
|
+
stem_up_extension: 0,
|
|
882
|
+
stem_down_extension: 0,
|
|
883
|
+
tabnote_stem_up_extension: 0,
|
|
884
|
+
tabnote_stem_down_extension: 0,
|
|
865
885
|
dot_shiftY: 0,
|
|
866
886
|
line_above: 0,
|
|
867
887
|
line_below: 0,
|
|
@@ -904,6 +924,10 @@ const durationCodes = {
|
|
|
904
924
|
flag: true,
|
|
905
925
|
code_flag_upstem: 'flag16thUp',
|
|
906
926
|
code_flag_downstem: 'flag16thDown',
|
|
927
|
+
stem_up_extension: 0,
|
|
928
|
+
stem_down_extension: 0,
|
|
929
|
+
tabnote_stem_up_extension: 0,
|
|
930
|
+
tabnote_stem_down_extension: 0,
|
|
907
931
|
dot_shiftY: 0,
|
|
908
932
|
line_above: 0,
|
|
909
933
|
line_below: 0,
|
|
@@ -946,6 +970,10 @@ const durationCodes = {
|
|
|
946
970
|
flag: true,
|
|
947
971
|
code_flag_upstem: 'flag32ndUp',
|
|
948
972
|
code_flag_downstem: 'flag32ndDown',
|
|
973
|
+
stem_up_extension: 9,
|
|
974
|
+
stem_down_extension: 9,
|
|
975
|
+
tabnote_stem_up_extension: 9,
|
|
976
|
+
tabnote_stem_down_extension: 9,
|
|
949
977
|
dot_shiftY: 0,
|
|
950
978
|
line_above: 0,
|
|
951
979
|
line_below: 0,
|
|
@@ -988,6 +1016,10 @@ const durationCodes = {
|
|
|
988
1016
|
flag: true,
|
|
989
1017
|
code_flag_upstem: 'flag64thUp',
|
|
990
1018
|
code_flag_downstem: 'flag64thDown',
|
|
1019
|
+
stem_up_extension: 13,
|
|
1020
|
+
stem_down_extension: 13,
|
|
1021
|
+
tabnote_stem_up_extension: 13,
|
|
1022
|
+
tabnote_stem_down_extension: 13,
|
|
991
1023
|
dot_shiftY: 0,
|
|
992
1024
|
line_above: 0,
|
|
993
1025
|
line_below: 0,
|
|
@@ -1030,6 +1062,10 @@ const durationCodes = {
|
|
|
1030
1062
|
flag: true,
|
|
1031
1063
|
code_flag_upstem: 'flag128thUp',
|
|
1032
1064
|
code_flag_downstem: 'flag128thDown',
|
|
1065
|
+
stem_up_extension: 22,
|
|
1066
|
+
stem_down_extension: 22,
|
|
1067
|
+
tabnote_stem_up_extension: 22,
|
|
1068
|
+
tabnote_stem_down_extension: 22,
|
|
1033
1069
|
dot_shiftY: 0,
|
|
1034
1070
|
line_above: 0,
|
|
1035
1071
|
line_below: 0,
|
package/build/esm/src/tabnote.js
CHANGED
|
@@ -106,11 +106,12 @@ export class TabNote extends StemmableNote {
|
|
|
106
106
|
return false;
|
|
107
107
|
}
|
|
108
108
|
getStemExtension() {
|
|
109
|
+
const glyph = this.getGlyph();
|
|
109
110
|
if (this.stem_extension_override != null) {
|
|
110
111
|
return this.stem_extension_override;
|
|
111
112
|
}
|
|
112
|
-
if (
|
|
113
|
-
return this.getStemDirection() ===
|
|
113
|
+
if (glyph) {
|
|
114
|
+
return this.getStemDirection() === Stem.UP ? glyph.tabnote_stem_up_extension : glyph.tabnote_stem_down_extension;
|
|
114
115
|
}
|
|
115
116
|
return 0;
|
|
116
117
|
}
|
|
@@ -204,16 +205,18 @@ export class TabNote extends StemmableNote {
|
|
|
204
205
|
return this.checkStem().getExtents();
|
|
205
206
|
}
|
|
206
207
|
drawFlag() {
|
|
207
|
-
|
|
208
|
+
var _a;
|
|
209
|
+
const { beam, glyph, render_options: { draw_stem }, } = this;
|
|
208
210
|
const context = this.checkContext();
|
|
209
211
|
const shouldDrawFlag = beam == undefined && draw_stem;
|
|
210
212
|
if (glyph.flag && shouldDrawFlag) {
|
|
211
|
-
const flag_x = this.getStemX()
|
|
212
|
-
const flag_y = this.
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
:
|
|
216
|
-
|
|
213
|
+
const flag_x = this.getStemX();
|
|
214
|
+
const flag_y = this.getStemDirection() === Stem.DOWN
|
|
215
|
+
?
|
|
216
|
+
this.getStemY() - this.checkStem().getHeight() - (this.glyph ? this.glyph.stem_down_extension : 0)
|
|
217
|
+
:
|
|
218
|
+
this.getStemY() - this.checkStem().getHeight() + (this.glyph ? this.glyph.stem_up_extension : 0);
|
|
219
|
+
(_a = this.flag) === null || _a === void 0 ? void 0 : _a.render(context, flag_x, flag_y);
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
drawModifiers() {
|
package/build/esm/src/version.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const VERSION = '4.0.1-
|
|
2
|
-
export const ID = '
|
|
3
|
-
export const DATE = '2022-02-
|
|
1
|
+
export const VERSION = '4.0.1-beta.0';
|
|
2
|
+
export const ID = '9fbdff60979ed561ff45bc4ab0b0a9dc18fde898';
|
|
3
|
+
export const DATE = '2022-02-17T01:06:16.478Z';
|
|
@@ -205,28 +205,10 @@ function verticalPlacement(options, contextBuilder) {
|
|
|
205
205
|
function drawArticulations2(options) {
|
|
206
206
|
expect(0);
|
|
207
207
|
const scale = 0.8;
|
|
208
|
-
|
|
209
|
-
const y = 30;
|
|
210
|
-
const width = 350 - Stave.defaultPadding;
|
|
211
|
-
const f = VexFlowTests.makeFactory(options, 1000, 195);
|
|
208
|
+
const f = VexFlowTests.makeFactory(options, 1500, 195);
|
|
212
209
|
const ctx = f.getContext();
|
|
213
210
|
ctx.scale(scale, scale);
|
|
214
|
-
const
|
|
215
|
-
const formatAndDrawToWidth = (x, y, width, notes, barline, beams) => {
|
|
216
|
-
const voices = [score.voice(notes, { time: '4/4' })];
|
|
217
|
-
const formatter = f.Formatter();
|
|
218
|
-
voices.forEach((v) => formatter.joinVoices([v]));
|
|
219
|
-
const nwidth = Math.max(formatter.preCalculateMinTotalWidth(voices), width);
|
|
220
|
-
formatter.format(voices, nwidth);
|
|
221
|
-
const stave = f
|
|
222
|
-
.Stave({ x: x, y: y, width: nwidth + Stave.defaultPadding })
|
|
223
|
-
.setEndBarType(barline)
|
|
224
|
-
.setContext(ctx)
|
|
225
|
-
.draw();
|
|
226
|
-
voices.forEach((voice) => voice.draw(ctx, stave));
|
|
227
|
-
beams.forEach((beam) => beam.setContext(ctx).draw());
|
|
228
|
-
return stave.getWidth();
|
|
229
|
-
};
|
|
211
|
+
const stave1 = new Stave(10, 50, 500).setContext(ctx).draw();
|
|
230
212
|
const notesBar1 = [
|
|
231
213
|
f.StaveNote({ keys: ['c/4'], duration: '16', stem_direction: 1 }),
|
|
232
214
|
f.StaveNote({ keys: ['d/4'], duration: '16', stem_direction: 1 }),
|
|
@@ -255,9 +237,10 @@ function drawArticulations2(options) {
|
|
|
255
237
|
}
|
|
256
238
|
const beam1 = new Beam(notesBar1.slice(0, 8));
|
|
257
239
|
const beam2 = new Beam(notesBar1.slice(8, 16));
|
|
258
|
-
|
|
240
|
+
Formatter.FormatAndDraw(ctx, stave1, notesBar1);
|
|
259
241
|
beam1.setContext(ctx).draw();
|
|
260
242
|
beam2.setContext(ctx).draw();
|
|
243
|
+
const stave2 = new Stave(510, 50, 500).setContext(ctx).draw();
|
|
261
244
|
const notesBar2 = [
|
|
262
245
|
f.StaveNote({ keys: ['f/3'], duration: '16', stem_direction: 1 }),
|
|
263
246
|
f.StaveNote({ keys: ['g/3'], duration: '16', stem_direction: 1 }),
|
|
@@ -285,12 +268,16 @@ function drawArticulations2(options) {
|
|
|
285
268
|
}
|
|
286
269
|
const beam3 = new Beam(notesBar2.slice(0, 8));
|
|
287
270
|
const beam4 = new Beam(notesBar2.slice(8, 16));
|
|
288
|
-
|
|
271
|
+
Formatter.FormatAndDraw(ctx, stave2, notesBar2);
|
|
272
|
+
beam3.setContext(ctx).draw();
|
|
273
|
+
beam4.setContext(ctx).draw();
|
|
274
|
+
const stave3 = new Stave(1010, 50, 100).setContext(ctx).draw();
|
|
289
275
|
const notesBar3 = [f.StaveNote({ keys: ['c/4'], duration: 'w', stem_direction: 1 })];
|
|
290
276
|
notesBar3[0].addModifier(new Articulation('a-').setPosition(3), 0);
|
|
291
277
|
notesBar3[0].addModifier(new Articulation('a>').setPosition(3), 0);
|
|
292
278
|
notesBar3[0].addModifier(new Articulation('a@a').setPosition(3), 0);
|
|
293
|
-
|
|
279
|
+
Formatter.FormatAndDraw(ctx, stave3, notesBar3);
|
|
280
|
+
const stave4 = new Stave(1110, 50, 250).setContext(ctx).draw();
|
|
294
281
|
const notesBar4 = [
|
|
295
282
|
f.StaveNote({ keys: ['c/5'], duration: 'q', stem_direction: -1 }),
|
|
296
283
|
f.StaveNote({ keys: ['a/5'], duration: 'q', stem_direction: -1 }),
|
|
@@ -304,7 +291,7 @@ function drawArticulations2(options) {
|
|
|
304
291
|
}
|
|
305
292
|
notesBar4[i].addModifier(new Articulation('a-').setPosition(position1), 0);
|
|
306
293
|
}
|
|
307
|
-
|
|
294
|
+
Formatter.FormatAndDraw(ctx, stave4, notesBar4);
|
|
308
295
|
}
|
|
309
296
|
function tabNotes(options, contextBuilder) {
|
|
310
297
|
const ctx = contextBuilder(options.elementId, 600, 200);
|
|
@@ -160,7 +160,6 @@ function drawOrnamentsWithAccidentals(options, contextBuilder) {
|
|
|
160
160
|
];
|
|
161
161
|
notes[0].addModifier(new Ornament('mordent').setUpperAccidental('#').setLowerAccidental('#'), 0);
|
|
162
162
|
notes[1].addModifier(new Ornament('turn_inverted').setLowerAccidental('b').setUpperAccidental('b'), 0);
|
|
163
|
-
notes[1].addModifier(new Ornament('turn_inverted').setLowerAccidental('b').setUpperAccidental('b'), 0);
|
|
164
163
|
notes[2].addModifier(new Ornament('turn').setUpperAccidental('##').setLowerAccidental('##'), 0);
|
|
165
164
|
notes[3].addModifier(new Ornament('mordent_inverted').setLowerAccidental('db').setUpperAccidental('db'), 0);
|
|
166
165
|
notes[4].addModifier(new Ornament('turn_inverted').setUpperAccidental('++').setLowerAccidental('++'), 0);
|
|
@@ -3379,11 +3379,17 @@ export declare const Font: {
|
|
|
3379
3379
|
};
|
|
3380
3380
|
};
|
|
3381
3381
|
staveRepetition: {
|
|
3382
|
-
|
|
3382
|
+
symbolText: {
|
|
3383
|
+
offsetX: number;
|
|
3383
3384
|
offsetY: number;
|
|
3384
|
-
offsetSymbol: number;
|
|
3385
3385
|
spacing: number;
|
|
3386
3386
|
};
|
|
3387
|
+
coda: {
|
|
3388
|
+
offsetY: number;
|
|
3389
|
+
};
|
|
3390
|
+
segno: {
|
|
3391
|
+
offsetY: number;
|
|
3392
|
+
};
|
|
3387
3393
|
};
|
|
3388
3394
|
stem: {
|
|
3389
3395
|
heightAdjustmentForFlag: number;
|
|
@@ -3437,9 +3443,6 @@ export declare const Font: {
|
|
|
3437
3443
|
};
|
|
3438
3444
|
flag: {
|
|
3439
3445
|
shiftX: number;
|
|
3440
|
-
tabStem: {
|
|
3441
|
-
shiftX: number;
|
|
3442
|
-
};
|
|
3443
3446
|
staveTempo: {
|
|
3444
3447
|
shiftX: number;
|
|
3445
3448
|
};
|
|
@@ -958,11 +958,17 @@ export declare const Font: {
|
|
|
958
958
|
};
|
|
959
959
|
};
|
|
960
960
|
staveRepetition: {
|
|
961
|
-
|
|
961
|
+
symbolText: {
|
|
962
|
+
offsetX: number;
|
|
962
963
|
offsetY: number;
|
|
963
|
-
offsetSymbol: number;
|
|
964
964
|
spacing: number;
|
|
965
965
|
};
|
|
966
|
+
coda: {
|
|
967
|
+
offsetY: number;
|
|
968
|
+
};
|
|
969
|
+
segno: {
|
|
970
|
+
offsetY: number;
|
|
971
|
+
};
|
|
966
972
|
};
|
|
967
973
|
stem: {
|
|
968
974
|
heightAdjustmentForFlag: number;
|
|
@@ -1475,11 +1475,17 @@ export declare const Font: {
|
|
|
1475
1475
|
};
|
|
1476
1476
|
};
|
|
1477
1477
|
staveRepetition: {
|
|
1478
|
-
|
|
1478
|
+
symbolText: {
|
|
1479
|
+
offsetX: number;
|
|
1479
1480
|
offsetY: number;
|
|
1480
|
-
offsetSymbol: number;
|
|
1481
1481
|
spacing: number;
|
|
1482
1482
|
};
|
|
1483
|
+
coda: {
|
|
1484
|
+
offsetY: number;
|
|
1485
|
+
};
|
|
1486
|
+
segno: {
|
|
1487
|
+
offsetY: number;
|
|
1488
|
+
};
|
|
1483
1489
|
};
|
|
1484
1490
|
noteHead: {
|
|
1485
1491
|
displaced: {
|
|
@@ -1562,9 +1568,6 @@ export declare const Font: {
|
|
|
1562
1568
|
flag128thDown: {
|
|
1563
1569
|
shiftX: number;
|
|
1564
1570
|
};
|
|
1565
|
-
tabStem: {
|
|
1566
|
-
shiftX: number;
|
|
1567
|
-
};
|
|
1568
1571
|
staveTempo: {
|
|
1569
1572
|
shiftX: number;
|
|
1570
1573
|
};
|
|
@@ -143,11 +143,17 @@ export declare const BravuraMetrics: {
|
|
|
143
143
|
};
|
|
144
144
|
};
|
|
145
145
|
staveRepetition: {
|
|
146
|
-
|
|
146
|
+
symbolText: {
|
|
147
|
+
offsetX: number;
|
|
147
148
|
offsetY: number;
|
|
148
|
-
offsetSymbol: number;
|
|
149
149
|
spacing: number;
|
|
150
150
|
};
|
|
151
|
+
coda: {
|
|
152
|
+
offsetY: number;
|
|
153
|
+
};
|
|
154
|
+
segno: {
|
|
155
|
+
offsetY: number;
|
|
156
|
+
};
|
|
151
157
|
};
|
|
152
158
|
stem: {
|
|
153
159
|
heightAdjustmentForFlag: number;
|
|
@@ -201,9 +207,6 @@ export declare const BravuraMetrics: {
|
|
|
201
207
|
};
|
|
202
208
|
flag: {
|
|
203
209
|
shiftX: number;
|
|
204
|
-
tabStem: {
|
|
205
|
-
shiftX: number;
|
|
206
|
-
};
|
|
207
210
|
staveTempo: {
|
|
208
211
|
shiftX: number;
|
|
209
212
|
};
|
|
@@ -133,11 +133,17 @@ export declare const GonvilleMetrics: {
|
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
135
|
staveRepetition: {
|
|
136
|
-
|
|
136
|
+
symbolText: {
|
|
137
|
+
offsetX: number;
|
|
137
138
|
offsetY: number;
|
|
138
|
-
offsetSymbol: number;
|
|
139
139
|
spacing: number;
|
|
140
140
|
};
|
|
141
|
+
coda: {
|
|
142
|
+
offsetY: number;
|
|
143
|
+
};
|
|
144
|
+
segno: {
|
|
145
|
+
offsetY: number;
|
|
146
|
+
};
|
|
141
147
|
};
|
|
142
148
|
stem: {
|
|
143
149
|
heightAdjustmentForFlag: number;
|
|
@@ -143,11 +143,17 @@ export declare const PetalumaMetrics: {
|
|
|
143
143
|
};
|
|
144
144
|
};
|
|
145
145
|
staveRepetition: {
|
|
146
|
-
|
|
146
|
+
symbolText: {
|
|
147
|
+
offsetX: number;
|
|
147
148
|
offsetY: number;
|
|
148
|
-
offsetSymbol: number;
|
|
149
149
|
spacing: number;
|
|
150
150
|
};
|
|
151
|
+
coda: {
|
|
152
|
+
offsetY: number;
|
|
153
|
+
};
|
|
154
|
+
segno: {
|
|
155
|
+
offsetY: number;
|
|
156
|
+
};
|
|
151
157
|
};
|
|
152
158
|
noteHead: {
|
|
153
159
|
displaced: {
|
|
@@ -230,9 +236,6 @@ export declare const PetalumaMetrics: {
|
|
|
230
236
|
flag128thDown: {
|
|
231
237
|
shiftX: number;
|
|
232
238
|
};
|
|
233
|
-
tabStem: {
|
|
234
|
-
shiftX: number;
|
|
235
|
-
};
|
|
236
239
|
staveTempo: {
|
|
237
240
|
shiftX: number;
|
|
238
241
|
};
|