vexflow 4.0.1-alpha.2 → 4.0.1-beta.2
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 +345 -115
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +247 -78
- 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/annotation.js +24 -5
- package/build/esm/src/articulation.js +5 -2
- package/build/esm/src/beam.js +4 -0
- package/build/esm/src/fonts/bravura_metrics.js +8 -5
- package/build/esm/src/fonts/gonville_glyphs.js +4 -4
- 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/note.js +1 -1
- package/build/esm/src/stavenote.js +88 -22
- 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/formatter_tests.js +2 -2
- package/build/esm/tests/gracenote_tests.js +43 -0
- package/build/esm/tests/ornament_tests.js +0 -1
- package/build/esm/tests/stavenote_tests.js +32 -0
- 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/note.d.ts +1 -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/annotation.ts +27 -6
- package/src/articulation.ts +8 -2
- package/src/beam.ts +4 -0
- package/src/fonts/bravura_metrics.ts +8 -5
- package/src/fonts/gonville_glyphs.ts +4 -4
- 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/note.ts +2 -2
- package/src/stavenote.ts +97 -21
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VexFlow 4.0.1-
|
|
2
|
+
* VexFlow 4.0.1-beta.2 2022-02-27T01:14:47.524Z 567ba80618390639c170a60de47ab4d1f2eabbff
|
|
3
3
|
* Copyright (c) 2010 Mohit Muthanna Cheppudira <mohit@muthanna.com>
|
|
4
4
|
* https://www.vexflow.com https://github.com/0xfe/vexflow
|
|
5
5
|
*/
|
|
@@ -29,9 +29,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29
29
|
/* harmony export */ "ID": () => (/* binding */ ID),
|
|
30
30
|
/* harmony export */ "DATE": () => (/* binding */ DATE)
|
|
31
31
|
/* harmony export */ });
|
|
32
|
-
const VERSION = '4.0.1-
|
|
33
|
-
const ID = '
|
|
34
|
-
const DATE = '2022-02-
|
|
32
|
+
const VERSION = '4.0.1-beta.2';
|
|
33
|
+
const ID = '567ba80618390639c170a60de47ab4d1f2eabbff';
|
|
34
|
+
const DATE = '2022-02-27T01:14:47.524Z';
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
/***/ }),
|
|
@@ -295,7 +295,7 @@ class Accidental extends _modifier__WEBPACK_IMPORTED_MODULE_2__.Modifier {
|
|
|
295
295
|
if (note !== prevNote) {
|
|
296
296
|
// Iterate through all notes to get the displaced pixels
|
|
297
297
|
for (let n = 0; n < note.keys.length; ++n) {
|
|
298
|
-
shiftL = Math.max(note.getLeftDisplacedHeadPx(), shiftL);
|
|
298
|
+
shiftL = Math.max(note.getLeftDisplacedHeadPx() - note.getXShift(), shiftL);
|
|
299
299
|
}
|
|
300
300
|
prevNote = note;
|
|
301
301
|
}
|
|
@@ -780,7 +780,10 @@ class Annotation extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
|
|
|
780
780
|
static format(annotations, state) {
|
|
781
781
|
if (!annotations || annotations.length === 0)
|
|
782
782
|
return false;
|
|
783
|
-
let
|
|
783
|
+
let leftWidth = 0;
|
|
784
|
+
let rightWidth = 0;
|
|
785
|
+
let maxLeftGlyphWidth = 0;
|
|
786
|
+
let maxRightGlyphWidth = 0;
|
|
784
787
|
for (let i = 0; i < annotations.length; ++i) {
|
|
785
788
|
const annotation = annotations[i];
|
|
786
789
|
const textFormatter = _textformatter__WEBPACK_IMPORTED_MODULE_4__.TextFormatter.create(annotation.textFont);
|
|
@@ -788,6 +791,23 @@ class Annotation extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
|
|
|
788
791
|
const textLines = (5 + textFormatter.maxHeight) / _tables__WEBPACK_IMPORTED_MODULE_3__.Tables.STAVE_LINE_DISTANCE;
|
|
789
792
|
let verticalSpaceNeeded = textLines;
|
|
790
793
|
const note = annotation.checkAttachedNote();
|
|
794
|
+
const glyphWidth = note.getGlyph().getWidth();
|
|
795
|
+
// Get the text width from the font metrics.
|
|
796
|
+
const textWidth = textFormatter.getWidthForTextInPx(annotation.text);
|
|
797
|
+
if (annotation.horizontalJustification === AnnotationHorizontalJustify.LEFT) {
|
|
798
|
+
maxLeftGlyphWidth = Math.max(glyphWidth, maxLeftGlyphWidth);
|
|
799
|
+
leftWidth = Math.max(leftWidth, textWidth);
|
|
800
|
+
}
|
|
801
|
+
else if (annotation.horizontalJustification === AnnotationHorizontalJustify.RIGHT) {
|
|
802
|
+
maxRightGlyphWidth = Math.max(glyphWidth, maxLeftGlyphWidth);
|
|
803
|
+
rightWidth = Math.max(rightWidth, textWidth);
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
leftWidth = Math.max(leftWidth, textWidth / 2);
|
|
807
|
+
rightWidth = Math.max(rightWidth, textWidth / 2);
|
|
808
|
+
maxLeftGlyphWidth = Math.max(glyphWidth / 2, maxLeftGlyphWidth);
|
|
809
|
+
maxRightGlyphWidth = Math.max(glyphWidth / 2, maxRightGlyphWidth);
|
|
810
|
+
}
|
|
791
811
|
const stave = note.getStave();
|
|
792
812
|
const stemDirection = note.hasStem() ? note.getStemDirection() : _stem__WEBPACK_IMPORTED_MODULE_2__.Stem.UP;
|
|
793
813
|
let stemHeight = 0;
|
|
@@ -812,9 +832,6 @@ class Annotation extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
|
|
|
812
832
|
if (stave) {
|
|
813
833
|
lines = stave.getNumLines();
|
|
814
834
|
}
|
|
815
|
-
// Get the text width from the font metrics.
|
|
816
|
-
const textWidth = textFormatter.getWidthForTextInPx(annotation.text);
|
|
817
|
-
width = Math.max(width, textWidth);
|
|
818
835
|
if (annotation.verticalJustification === this.VerticalJustify.TOP) {
|
|
819
836
|
let noteLine = note.getLineNumber(true);
|
|
820
837
|
if ((0,_typeguard__WEBPACK_IMPORTED_MODULE_5__.isTabNote)(note)) {
|
|
@@ -857,8 +874,10 @@ class Annotation extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
|
|
|
857
874
|
annotation.setTextLine(state.text_line);
|
|
858
875
|
}
|
|
859
876
|
}
|
|
860
|
-
|
|
861
|
-
|
|
877
|
+
const rightOverlap = Math.min(Math.max(rightWidth - maxRightGlyphWidth, 0), Math.max(rightWidth - state.right_shift, 0));
|
|
878
|
+
const leftOverlap = Math.min(Math.max(leftWidth - maxLeftGlyphWidth, 0), Math.max(leftWidth - state.left_shift, 0));
|
|
879
|
+
state.left_shift += leftOverlap / 2;
|
|
880
|
+
state.right_shift += rightOverlap / 2;
|
|
862
881
|
return true;
|
|
863
882
|
}
|
|
864
883
|
/**
|
|
@@ -1190,9 +1209,11 @@ class Articulation extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
|
|
|
1190
1209
|
if (!articulations || articulations.length === 0)
|
|
1191
1210
|
return false;
|
|
1192
1211
|
const margin = 0.5;
|
|
1212
|
+
let maxGlyphWidth = 0;
|
|
1193
1213
|
const getIncrement = (articulation, line, position) => roundToNearestHalf(getRoundingFunction(line, position), (0,_util__WEBPACK_IMPORTED_MODULE_5__.defined)(articulation.glyph.getMetrics().height) / 10 + margin);
|
|
1194
1214
|
articulations.forEach((articulation) => {
|
|
1195
1215
|
const note = articulation.checkAttachedNote();
|
|
1216
|
+
maxGlyphWidth = Math.max(note.getGlyph().getWidth(), maxGlyphWidth);
|
|
1196
1217
|
let lines = 5;
|
|
1197
1218
|
const stemDirection = note.hasStem() ? note.getStemDirection() : _stem__WEBPACK_IMPORTED_MODULE_2__.Stem.UP;
|
|
1198
1219
|
let stemHeight = 0;
|
|
@@ -1239,8 +1260,9 @@ class Articulation extends _modifier__WEBPACK_IMPORTED_MODULE_1__.Modifier {
|
|
|
1239
1260
|
const width = articulations
|
|
1240
1261
|
.map((articulation) => articulation.getWidth())
|
|
1241
1262
|
.reduce((maxWidth, articWidth) => Math.max(articWidth, maxWidth));
|
|
1242
|
-
state.left_shift
|
|
1243
|
-
state.
|
|
1263
|
+
const overlap = Math.min(Math.max(width - maxGlyphWidth, 0), Math.max(width - (state.left_shift + state.right_shift), 0));
|
|
1264
|
+
state.left_shift += overlap / 2;
|
|
1265
|
+
state.right_shift += overlap / 2;
|
|
1244
1266
|
return true;
|
|
1245
1267
|
}
|
|
1246
1268
|
static easyScoreHook({ articulations }, note, builder) {
|
|
@@ -2138,7 +2160,9 @@ class Beam extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
|
|
|
2138
2160
|
this.notes.forEach((note) => {
|
|
2139
2161
|
const stem = note.getStem();
|
|
2140
2162
|
if (stem) {
|
|
2163
|
+
ctx.openGroup('stem', note.getAttribute('id') + '-stem');
|
|
2141
2164
|
stem.setContext(ctx).draw();
|
|
2165
|
+
ctx.closeGroup();
|
|
2142
2166
|
}
|
|
2143
2167
|
}, this);
|
|
2144
2168
|
}
|
|
@@ -2160,6 +2184,7 @@ class Beam extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
|
|
|
2160
2184
|
const lastBeamX = beam_line.end;
|
|
2161
2185
|
if (lastBeamX) {
|
|
2162
2186
|
const lastBeamY = this.getSlopeY(lastBeamX, firstStemX, beamY, this.slope);
|
|
2187
|
+
this.setAttribute('el', ctx.openGroup('beam'));
|
|
2163
2188
|
ctx.beginPath();
|
|
2164
2189
|
ctx.moveTo(startBeamX, startBeamY);
|
|
2165
2190
|
ctx.lineTo(startBeamX, startBeamY + beamThickness);
|
|
@@ -2167,6 +2192,7 @@ class Beam extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
|
|
|
2167
2192
|
ctx.lineTo(lastBeamX + 1, lastBeamY);
|
|
2168
2193
|
ctx.closePath();
|
|
2169
2194
|
ctx.fill();
|
|
2195
|
+
ctx.closeGroup();
|
|
2170
2196
|
}
|
|
2171
2197
|
else {
|
|
2172
2198
|
throw new _util__WEBPACK_IMPORTED_MODULE_6__.RuntimeError('NoLastBeamX', 'lastBeamX undefined.');
|
|
@@ -9974,11 +10000,17 @@ const BravuraMetrics = {
|
|
|
9974
10000
|
},
|
|
9975
10001
|
},
|
|
9976
10002
|
staveRepetition: {
|
|
9977
|
-
|
|
10003
|
+
symbolText: {
|
|
10004
|
+
offsetX: 12,
|
|
9978
10005
|
offsetY: 25,
|
|
9979
|
-
offsetSymbol: 12,
|
|
9980
10006
|
spacing: 5,
|
|
9981
10007
|
},
|
|
10008
|
+
coda: {
|
|
10009
|
+
offsetY: 25,
|
|
10010
|
+
},
|
|
10011
|
+
segno: {
|
|
10012
|
+
offsetY: 10,
|
|
10013
|
+
},
|
|
9982
10014
|
},
|
|
9983
10015
|
// noteHead: {
|
|
9984
10016
|
// },
|
|
@@ -10045,9 +10077,6 @@ const BravuraMetrics = {
|
|
|
10045
10077
|
},
|
|
10046
10078
|
flag: {
|
|
10047
10079
|
shiftX: -0.75,
|
|
10048
|
-
tabStem: {
|
|
10049
|
-
shiftX: -1.75,
|
|
10050
|
-
},
|
|
10051
10080
|
staveTempo: {
|
|
10052
10081
|
shiftX: -1,
|
|
10053
10082
|
},
|
|
@@ -11189,10 +11218,10 @@ const GonvilleFont = {
|
|
|
11189
11218
|
o: 'm -413 173 b -408 174 -412 174 -409 174 b -397 173 -404 174 -400 173 b -308 86 -394 172 -374 151 b -223 0 -261 37 -223 0 b -153 84 -223 0 -191 37 b -77 174 -83 173 -84 172 b -72 174 -76 174 -74 174 b -62 173 -68 174 -63 173 b 25 86 -59 172 -39 151 b 112 0 73 37 111 0 b 181 84 112 0 144 37 b 257 174 251 173 251 172 b 262 174 258 174 261 174 b 273 173 266 174 270 173 b 436 9 276 172 347 101 l 447 -1 l 477 36 b 522 79 511 79 513 79 l 522 79 b 552 51 533 79 539 73 b 596 -112 582 6 596 -51 b 567 -262 596 -161 586 -213 b 539 -322 558 -287 544 -316 b 524 -327 534 -326 529 -327 b 504 -315 515 -327 507 -323 b 503 -308 503 -312 503 -309 b 511 -285 503 -302 504 -297 b 555 -113 540 -227 555 -169 b 544 -34 555 -86 551 -59 b 522 19 540 -16 530 8 l 521 22 l 481 -26 l 405 -122 b 353 -176 366 -172 362 -176 b 349 -176 352 -176 351 -176 b 253 -87 341 -176 347 -180 b 167 0 206 -38 167 0 b 99 -86 167 0 136 -38 b 21 -174 27 -174 28 -173 b 17 -176 20 -176 19 -176 b 6 -174 13 -176 9 -174 b -81 -87 4 -173 -14 -152 b -167 0 -129 -38 -167 0 b -236 -86 -167 0 -198 -38 b -313 -174 -307 -174 -306 -173 b -318 -176 -314 -176 -315 -176 b -328 -174 -321 -176 -325 -174 b -491 -12 -330 -173 -367 -137 l -503 0 l -530 -34 b -570 -77 -562 -73 -564 -76 b -577 -79 -571 -79 -574 -79 b -597 -58 -588 -79 -597 -69 b -596 -49 -597 -55 -597 -52 b -417 172 -593 -43 -423 167 b -413 173 -417 172 -415 173 ',
|
|
11190
11219
|
},
|
|
11191
11220
|
stringsDownBow: {
|
|
11192
|
-
x_min: -
|
|
11193
|
-
x_max:
|
|
11194
|
-
ha:
|
|
11195
|
-
o: 'm -
|
|
11221
|
+
x_min: -228.671875,
|
|
11222
|
+
x_max: 227.3125,
|
|
11223
|
+
ha: 232,
|
|
11224
|
+
o: 'm -217 487 l -213 488 l 0 488 l 212 488 l 216 487 b 225 476 220 484 224 480 l 227 473 l 227 244 l 227 15 l 225 12 b 206 0 223 4 215 0 b 197 1 204 0 200 0 b 187 12 193 4 189 6 l 186 15 l 186 138 l 186 262 l -1 262 l -187 262 l -187 138 l -187 15 l -189 12 b -208 0 -193 4 -200 0 b -227 12 -216 0 -223 4 l -228 15 l -228 244 l -228 473 l -227 476 b -217 487 -225 480 -221 484 ',
|
|
11196
11225
|
},
|
|
11197
11226
|
stringsUpBow: {
|
|
11198
11227
|
x_min: -149.71875,
|
|
@@ -11456,11 +11485,17 @@ const GonvilleMetrics = {
|
|
|
11456
11485
|
},
|
|
11457
11486
|
},
|
|
11458
11487
|
staveRepetition: {
|
|
11459
|
-
|
|
11488
|
+
symbolText: {
|
|
11489
|
+
offsetX: 12,
|
|
11460
11490
|
offsetY: 25,
|
|
11461
|
-
offsetSymbol: 12,
|
|
11462
11491
|
spacing: 5,
|
|
11463
11492
|
},
|
|
11493
|
+
coda: {
|
|
11494
|
+
offsetY: 25,
|
|
11495
|
+
},
|
|
11496
|
+
segno: {
|
|
11497
|
+
offsetY: 0,
|
|
11498
|
+
},
|
|
11464
11499
|
},
|
|
11465
11500
|
// noteHead: {
|
|
11466
11501
|
// },
|
|
@@ -13401,11 +13436,17 @@ const PetalumaMetrics = {
|
|
|
13401
13436
|
},
|
|
13402
13437
|
},
|
|
13403
13438
|
staveRepetition: {
|
|
13404
|
-
|
|
13439
|
+
symbolText: {
|
|
13440
|
+
offsetX: 12,
|
|
13405
13441
|
offsetY: 25,
|
|
13406
|
-
offsetSymbol: 12,
|
|
13407
13442
|
spacing: 5,
|
|
13408
13443
|
},
|
|
13444
|
+
coda: {
|
|
13445
|
+
offsetY: 25,
|
|
13446
|
+
},
|
|
13447
|
+
segno: {
|
|
13448
|
+
offsetY: 10,
|
|
13449
|
+
},
|
|
13409
13450
|
},
|
|
13410
13451
|
noteHead: {
|
|
13411
13452
|
displaced: {
|
|
@@ -13499,9 +13540,6 @@ const PetalumaMetrics = {
|
|
|
13499
13540
|
flag128thDown: {
|
|
13500
13541
|
shiftX: -1.2,
|
|
13501
13542
|
},
|
|
13502
|
-
tabStem: {
|
|
13503
|
-
shiftX: -1.75,
|
|
13504
|
-
},
|
|
13505
13543
|
staveTempo: {
|
|
13506
13544
|
shiftX: -1,
|
|
13507
13545
|
},
|
|
@@ -17498,7 +17536,6 @@ class GraceNote extends _stavenote__WEBPACK_IMPORTED_MODULE_0__.StaveNote {
|
|
|
17498
17536
|
}
|
|
17499
17537
|
return 0;
|
|
17500
17538
|
}
|
|
17501
|
-
// FIXME: move this to more basic class.
|
|
17502
17539
|
getStaveNoteScale() {
|
|
17503
17540
|
return this.render_options.glyph_font_scale / _tables__WEBPACK_IMPORTED_MODULE_2__.Tables.NOTATION_FONT_SCALE;
|
|
17504
17541
|
}
|
|
@@ -17530,8 +17567,10 @@ class GraceNote extends _stavenote__WEBPACK_IMPORTED_MODULE_0__.StaveNote {
|
|
|
17530
17567
|
let y = stem_direction === _stem__WEBPACK_IMPORTED_MODULE_1__.Stem.DOWN
|
|
17531
17568
|
? noteHeadBounds.y_top - noteStemHeight
|
|
17532
17569
|
: noteHeadBounds.y_bottom - noteStemHeight;
|
|
17570
|
+
const defaultStemExtention = stem_direction === _stem__WEBPACK_IMPORTED_MODULE_1__.Stem.DOWN ? this.glyph.stem_down_extension : this.glyph.stem_up_extension;
|
|
17533
17571
|
let defaultOffsetY = _tables__WEBPACK_IMPORTED_MODULE_2__.Tables.STEM_HEIGHT;
|
|
17534
17572
|
defaultOffsetY -= defaultOffsetY / 2.8;
|
|
17573
|
+
defaultOffsetY += defaultStemExtention;
|
|
17535
17574
|
y += defaultOffsetY * staveNoteScale * stem_direction;
|
|
17536
17575
|
const offsets = stem_direction === _stem__WEBPACK_IMPORTED_MODULE_1__.Stem.UP
|
|
17537
17576
|
? {
|
|
@@ -19997,9 +20036,9 @@ class Note extends _tickable__WEBPACK_IMPORTED_MODULE_3__.Tickable {
|
|
|
19997
20036
|
super.addModifier(modifier);
|
|
19998
20037
|
return this;
|
|
19999
20038
|
}
|
|
20000
|
-
|
|
20039
|
+
/** Get all modifiers of a specific type in `this.modifiers`. */
|
|
20001
20040
|
getModifiersByType(type) {
|
|
20002
|
-
return this.
|
|
20041
|
+
return this.modifiers.filter((modifier) => modifier.getCategory() === type);
|
|
20003
20042
|
}
|
|
20004
20043
|
/** Get the coordinates for where modifiers begin. */
|
|
20005
20044
|
// eslint-disable-next-line
|
|
@@ -23599,7 +23638,7 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
23599
23638
|
let xShift = 0;
|
|
23600
23639
|
// Test for two voice note intersection
|
|
23601
23640
|
if (voices === 2) {
|
|
23602
|
-
const lineSpacing = noteU.stemDirection === noteL.stemDirection ? 0.0 : 0.5;
|
|
23641
|
+
const lineSpacing = noteU.note.hasStem() && noteL.note.hasStem() && noteU.stemDirection === noteL.stemDirection ? 0.0 : 0.5;
|
|
23603
23642
|
if (noteU.minLine <= noteL.maxLine + lineSpacing) {
|
|
23604
23643
|
if (noteU.isrest) {
|
|
23605
23644
|
// shift rest up
|
|
@@ -23609,15 +23648,80 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
23609
23648
|
// shift rest down
|
|
23610
23649
|
shiftRestVertical(noteL, noteU, -1);
|
|
23611
23650
|
}
|
|
23612
|
-
else if (noteU.stemDirection === noteL.stemDirection) {
|
|
23613
|
-
// upper voice is middle voice, so shift it right
|
|
23614
|
-
xShift = voiceXShift + 2;
|
|
23615
|
-
noteU.note.setXShift(xShift);
|
|
23616
|
-
}
|
|
23617
23651
|
else {
|
|
23618
|
-
//
|
|
23619
|
-
|
|
23620
|
-
|
|
23652
|
+
//Instead of shifting notes, remove the appropriate flag
|
|
23653
|
+
//If we are sharing a line, switch one notes stem direction.
|
|
23654
|
+
//If we are sharing a line and in the same voice, only then offset one note
|
|
23655
|
+
const lineDiff = Math.abs(noteU.line - noteL.line);
|
|
23656
|
+
if (noteU.note.hasStem() && noteL.note.hasStem()) {
|
|
23657
|
+
//If we have different dot values, must offset
|
|
23658
|
+
//Or If we have a white mixed with a black notehead, must offset
|
|
23659
|
+
let whiteNoteHeadCount = 0;
|
|
23660
|
+
let blackNoteHeadCount = 0;
|
|
23661
|
+
if (_tables__WEBPACK_IMPORTED_MODULE_5__.Tables.durationToNumber(noteU.note.duration) === 2) {
|
|
23662
|
+
whiteNoteHeadCount++;
|
|
23663
|
+
}
|
|
23664
|
+
else if (_tables__WEBPACK_IMPORTED_MODULE_5__.Tables.durationToNumber(noteU.note.duration) > 2) {
|
|
23665
|
+
blackNoteHeadCount++;
|
|
23666
|
+
}
|
|
23667
|
+
if (_tables__WEBPACK_IMPORTED_MODULE_5__.Tables.durationToNumber(noteL.note.duration) === 2) {
|
|
23668
|
+
whiteNoteHeadCount++;
|
|
23669
|
+
}
|
|
23670
|
+
else if (_tables__WEBPACK_IMPORTED_MODULE_5__.Tables.durationToNumber(noteL.note.duration) > 2) {
|
|
23671
|
+
blackNoteHeadCount++;
|
|
23672
|
+
}
|
|
23673
|
+
if ((whiteNoteHeadCount !== 2 && blackNoteHeadCount !== 2) ||
|
|
23674
|
+
noteU.note.getModifiersByType(_typeguard__WEBPACK_IMPORTED_MODULE_6__.Category.Dot).length !== noteL.note.getModifiersByType(_typeguard__WEBPACK_IMPORTED_MODULE_6__.Category.Dot).length) {
|
|
23675
|
+
xShift = voiceXShift + 2;
|
|
23676
|
+
if (noteU.stemDirection === noteL.stemDirection) {
|
|
23677
|
+
// upper voice is middle voice, so shift it right
|
|
23678
|
+
noteU.note.setXShift(xShift);
|
|
23679
|
+
}
|
|
23680
|
+
else {
|
|
23681
|
+
// shift lower voice right
|
|
23682
|
+
noteL.note.setXShift(xShift);
|
|
23683
|
+
}
|
|
23684
|
+
}
|
|
23685
|
+
else if (lineDiff < 1 && lineDiff > 0) {
|
|
23686
|
+
//if the notes are quite close but not on the same line, shift
|
|
23687
|
+
xShift = voiceXShift + 2;
|
|
23688
|
+
if (noteU.stemDirection === noteL.stemDirection) {
|
|
23689
|
+
// upper voice is middle voice, so shift it right
|
|
23690
|
+
noteU.note.setXShift(xShift);
|
|
23691
|
+
}
|
|
23692
|
+
else {
|
|
23693
|
+
// shift lower voice right
|
|
23694
|
+
noteL.note.setXShift(xShift);
|
|
23695
|
+
}
|
|
23696
|
+
}
|
|
23697
|
+
else if (noteU.note.voice !== noteL.note.voice) {
|
|
23698
|
+
//If we are not in the same voice
|
|
23699
|
+
if (noteU.stemDirection === noteL.stemDirection) {
|
|
23700
|
+
if (noteU.line != noteL.line) {
|
|
23701
|
+
xShift = voiceXShift + 2;
|
|
23702
|
+
noteU.note.setXShift(xShift);
|
|
23703
|
+
}
|
|
23704
|
+
else {
|
|
23705
|
+
//same line, swap stem direction for one note
|
|
23706
|
+
if (noteL.stemDirection === 1) {
|
|
23707
|
+
noteL.stemDirection = -1;
|
|
23708
|
+
noteL.note.setStemDirection(-1);
|
|
23709
|
+
}
|
|
23710
|
+
}
|
|
23711
|
+
}
|
|
23712
|
+
} //Very close whole notes
|
|
23713
|
+
}
|
|
23714
|
+
else {
|
|
23715
|
+
xShift = voiceXShift + 2;
|
|
23716
|
+
if (noteU.stemDirection === noteL.stemDirection) {
|
|
23717
|
+
// upper voice is middle voice, so shift it right
|
|
23718
|
+
noteU.note.setXShift(xShift);
|
|
23719
|
+
}
|
|
23720
|
+
else {
|
|
23721
|
+
// shift lower voice right
|
|
23722
|
+
noteL.note.setXShift(xShift);
|
|
23723
|
+
}
|
|
23724
|
+
}
|
|
23621
23725
|
}
|
|
23622
23726
|
}
|
|
23623
23727
|
// format complete
|
|
@@ -23725,7 +23829,7 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
23725
23829
|
setBeam(beam) {
|
|
23726
23830
|
this.beam = beam;
|
|
23727
23831
|
this.calcNoteDisplacements();
|
|
23728
|
-
// Update stem extension
|
|
23832
|
+
// Update stem extension if a beam is assigned.
|
|
23729
23833
|
if (this.stem) {
|
|
23730
23834
|
this.stem.setExtension(this.getStemExtension());
|
|
23731
23835
|
}
|
|
@@ -24050,15 +24154,16 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
24050
24154
|
// Sets the style of the complete StaveNote, including all keys
|
|
24051
24155
|
// and the stem.
|
|
24052
24156
|
setStyle(style) {
|
|
24053
|
-
var _a;
|
|
24054
24157
|
super.setStyle(style);
|
|
24055
24158
|
this._noteHeads.forEach((notehead) => notehead.setStyle(style));
|
|
24056
|
-
(
|
|
24159
|
+
if (this.stem)
|
|
24160
|
+
this.stem.setStyle(style);
|
|
24057
24161
|
return this;
|
|
24058
24162
|
}
|
|
24059
24163
|
setStemStyle(style) {
|
|
24060
24164
|
const stem = this.getStem();
|
|
24061
|
-
|
|
24165
|
+
if (stem)
|
|
24166
|
+
stem.setStyle(style);
|
|
24062
24167
|
return this;
|
|
24063
24168
|
}
|
|
24064
24169
|
getStemStyle() {
|
|
@@ -24283,7 +24388,7 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
24283
24388
|
}
|
|
24284
24389
|
// Draw the flag for the note
|
|
24285
24390
|
drawFlag() {
|
|
24286
|
-
var _a;
|
|
24391
|
+
var _a, _b, _c, _d, _e;
|
|
24287
24392
|
const ctx = this.checkContext();
|
|
24288
24393
|
if (!ctx) {
|
|
24289
24394
|
throw new _util__WEBPACK_IMPORTED_MODULE_7__.RuntimeError('NoCanvasContext', "Can't draw without a canvas context.");
|
|
@@ -24293,20 +24398,27 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
24293
24398
|
// eslint-disable-next-line
|
|
24294
24399
|
const noteStemHeight = this.stem.getHeight();
|
|
24295
24400
|
const flagX = this.getStemX();
|
|
24296
|
-
//
|
|
24401
|
+
// What's with the magic +/- 2
|
|
24297
24402
|
// ANSWER: a corner of the note stem pokes out beyond the tip of the flag.
|
|
24298
24403
|
// The extra +/- 2 pushes the flag glyph outward so it covers the stem entirely.
|
|
24299
24404
|
// Alternatively, we could shorten the stem.
|
|
24300
|
-
const extension = this.flag !== undefined ? this.flag.checkMetrics().y_shift : 0;
|
|
24301
24405
|
const flagY = this.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_3__.Stem.DOWN
|
|
24302
24406
|
? // Down stems are below the note head and have flags on the right.
|
|
24303
|
-
y_top -
|
|
24407
|
+
y_top -
|
|
24408
|
+
noteStemHeight +
|
|
24409
|
+
2 -
|
|
24410
|
+
(this.glyph ? this.glyph.stem_down_extension : 0) * this.getStaveNoteScale() -
|
|
24411
|
+
((_b = (_a = this.flag) === null || _a === void 0 ? void 0 : _a.getMetrics().y_shift) !== null && _b !== void 0 ? _b : 0) * (1 - this.getStaveNoteScale())
|
|
24304
24412
|
: // Up stems are above the note head and have flags on the right.
|
|
24305
|
-
y_bottom -
|
|
24413
|
+
y_bottom -
|
|
24414
|
+
noteStemHeight -
|
|
24415
|
+
2 +
|
|
24416
|
+
(this.glyph ? this.glyph.stem_up_extension : 0) * this.getStaveNoteScale() -
|
|
24417
|
+
((_d = (_c = this.flag) === null || _c === void 0 ? void 0 : _c.getMetrics().y_shift) !== null && _d !== void 0 ? _d : 0) * (1 - this.getStaveNoteScale());
|
|
24306
24418
|
// Draw the Flag
|
|
24307
24419
|
ctx.openGroup('flag', undefined, { pointerBBox: true });
|
|
24308
24420
|
this.applyStyle(ctx, this.getFlagStyle());
|
|
24309
|
-
(
|
|
24421
|
+
(_e = this.flag) === null || _e === void 0 ? void 0 : _e.render(ctx, flagX, flagY);
|
|
24310
24422
|
this.restoreStyle(ctx, this.getFlagStyle());
|
|
24311
24423
|
ctx.closeGroup();
|
|
24312
24424
|
}
|
|
@@ -24321,7 +24433,6 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
24321
24433
|
});
|
|
24322
24434
|
}
|
|
24323
24435
|
drawStem(stemOptions) {
|
|
24324
|
-
var _a;
|
|
24325
24436
|
// GCR TODO: I can't find any context in which this is called with the stemStruct
|
|
24326
24437
|
// argument in the codebase or tests. Nor can I find a case where super.drawStem
|
|
24327
24438
|
// is called at all. Perhaps these should be removed?
|
|
@@ -24334,9 +24445,15 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
24334
24445
|
if (this.shouldDrawFlag() && this.stem) {
|
|
24335
24446
|
this.stem.adjustHeightForFlag();
|
|
24336
24447
|
}
|
|
24337
|
-
|
|
24338
|
-
|
|
24339
|
-
|
|
24448
|
+
if (this.stem) {
|
|
24449
|
+
ctx.openGroup('stem', undefined, { pointerBBox: true });
|
|
24450
|
+
this.stem.setContext(ctx).draw();
|
|
24451
|
+
ctx.closeGroup();
|
|
24452
|
+
}
|
|
24453
|
+
}
|
|
24454
|
+
/** Primarily used as the scaling factor for grace notes, GraceNote will return the required scale. */
|
|
24455
|
+
getStaveNoteScale() {
|
|
24456
|
+
return 1.0;
|
|
24340
24457
|
}
|
|
24341
24458
|
/**
|
|
24342
24459
|
* Override stemmablenote stem extension to adjust for distance from middle line.
|
|
@@ -24379,7 +24496,6 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
24379
24496
|
}
|
|
24380
24497
|
// Draws all the `StaveNote` parts. This is the main drawing method.
|
|
24381
24498
|
draw() {
|
|
24382
|
-
var _a;
|
|
24383
24499
|
if (this.ys.length === 0) {
|
|
24384
24500
|
throw new _util__WEBPACK_IMPORTED_MODULE_7__.RuntimeError('NoYValues', "Can't draw note without Y values.");
|
|
24385
24501
|
}
|
|
@@ -24388,9 +24504,11 @@ class StaveNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNot
|
|
|
24388
24504
|
const shouldRenderStem = this.hasStem() && !this.beam;
|
|
24389
24505
|
// Format note head x positions
|
|
24390
24506
|
this._noteHeads.forEach((notehead) => notehead.setX(xBegin));
|
|
24391
|
-
|
|
24392
|
-
|
|
24393
|
-
|
|
24507
|
+
if (this.stem) {
|
|
24508
|
+
// Format stem x positions
|
|
24509
|
+
const stemX = this.getStemX();
|
|
24510
|
+
this.stem.setNoteHeadXBounds(stemX, stemX);
|
|
24511
|
+
}
|
|
24394
24512
|
L('Rendering ', this.isChord() ? 'chord :' : 'note :', this.keys);
|
|
24395
24513
|
// Apply the overall style -- may be contradicted by local settings:
|
|
24396
24514
|
this.applyStyle();
|
|
@@ -24501,12 +24619,12 @@ class Repetition extends _stavemodifier__WEBPACK_IMPORTED_MODULE_2__.StaveModifi
|
|
|
24501
24619
|
}
|
|
24502
24620
|
drawCodaFixed(stave, x) {
|
|
24503
24621
|
const y = stave.getYForTopText(stave.getNumLines()) + this.y_shift;
|
|
24504
|
-
_glyph__WEBPACK_IMPORTED_MODULE_1__.Glyph.renderGlyph(stave.checkContext(), this.x + x + this.x_shift, y + _tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
24622
|
+
_glyph__WEBPACK_IMPORTED_MODULE_1__.Glyph.renderGlyph(stave.checkContext(), this.x + x + this.x_shift, y + _tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.coda.offsetY'), 40, 'coda', { category: 'coda' });
|
|
24505
24623
|
return this;
|
|
24506
24624
|
}
|
|
24507
24625
|
drawSignoFixed(stave, x) {
|
|
24508
24626
|
const y = stave.getYForTopText(stave.getNumLines()) + this.y_shift;
|
|
24509
|
-
_glyph__WEBPACK_IMPORTED_MODULE_1__.Glyph.renderGlyph(stave.checkContext(), this.x + x + this.x_shift, y + _tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
24627
|
+
_glyph__WEBPACK_IMPORTED_MODULE_1__.Glyph.renderGlyph(stave.checkContext(), this.x + x + this.x_shift, y + _tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.segno.offsetY'), 30, 'segno', { category: 'segno' });
|
|
24510
24628
|
return this;
|
|
24511
24629
|
}
|
|
24512
24630
|
drawSymbolText(stave, x, text, draw_coda) {
|
|
@@ -24524,7 +24642,7 @@ class Repetition extends _stavemodifier__WEBPACK_IMPORTED_MODULE_2__.StaveModifi
|
|
|
24524
24642
|
symbol_x =
|
|
24525
24643
|
text_x +
|
|
24526
24644
|
ctx.measureText(text).width +
|
|
24527
|
-
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
24645
|
+
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.offsetX');
|
|
24528
24646
|
break;
|
|
24529
24647
|
// To the right without symbol
|
|
24530
24648
|
case Repetition.type.DC:
|
|
@@ -24537,7 +24655,7 @@ class Repetition extends _stavemodifier__WEBPACK_IMPORTED_MODULE_2__.StaveModifi
|
|
|
24537
24655
|
x +
|
|
24538
24656
|
this.x_shift +
|
|
24539
24657
|
stave.getWidth() -
|
|
24540
|
-
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
24658
|
+
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.spacing') -
|
|
24541
24659
|
modifierWidth -
|
|
24542
24660
|
ctx.measureText(text).width;
|
|
24543
24661
|
break;
|
|
@@ -24548,19 +24666,19 @@ class Repetition extends _stavemodifier__WEBPACK_IMPORTED_MODULE_2__.StaveModifi
|
|
|
24548
24666
|
x +
|
|
24549
24667
|
this.x_shift +
|
|
24550
24668
|
stave.getWidth() -
|
|
24551
|
-
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
24669
|
+
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.spacing') -
|
|
24552
24670
|
modifierWidth -
|
|
24553
24671
|
ctx.measureText(text).width -
|
|
24554
|
-
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
24672
|
+
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.offsetX');
|
|
24555
24673
|
symbol_x =
|
|
24556
24674
|
text_x +
|
|
24557
24675
|
ctx.measureText(text).width +
|
|
24558
|
-
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
24676
|
+
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.offsetX');
|
|
24559
24677
|
break;
|
|
24560
24678
|
}
|
|
24561
24679
|
const y = stave.getYForTopText(stave.getNumLines()) +
|
|
24562
24680
|
this.y_shift +
|
|
24563
|
-
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.
|
|
24681
|
+
_tables__WEBPACK_IMPORTED_MODULE_3__.Tables.currentMusicFont().lookupMetric('staveRepetition.symbolText.offsetY');
|
|
24564
24682
|
if (draw_coda) {
|
|
24565
24683
|
_glyph__WEBPACK_IMPORTED_MODULE_1__.Glyph.renderGlyph(ctx, symbol_x, y, 40, 'coda', { category: 'coda' });
|
|
24566
24684
|
}
|
|
@@ -25007,12 +25125,20 @@ class StaveTie extends _element__WEBPACK_IMPORTED_MODULE_0__.Element {
|
|
|
25007
25125
|
}
|
|
25008
25126
|
const top_cp_y = (first_y_px + last_y_px) / 2 + cp1 * params.direction;
|
|
25009
25127
|
const bottom_cp_y = (first_y_px + last_y_px) / 2 + cp2 * params.direction;
|
|
25128
|
+
// id probably unnecessary if we save the group to 'el' via setAttribute
|
|
25129
|
+
// let id: string = "";
|
|
25130
|
+
// if (this.notes.first_note) {
|
|
25131
|
+
// id = this.notes.first_note.getAttribute('id') + '-tie';
|
|
25132
|
+
// }
|
|
25133
|
+
// this.setAttribute('el', ctx.openGroup('stavetie', id));
|
|
25134
|
+
this.setAttribute('el', ctx.openGroup('stavetie'));
|
|
25010
25135
|
ctx.beginPath();
|
|
25011
25136
|
ctx.moveTo(params.first_x_px + first_x_shift, first_y_px);
|
|
25012
25137
|
ctx.quadraticCurveTo(cp_x, top_cp_y, params.last_x_px + last_x_shift, last_y_px);
|
|
25013
25138
|
ctx.quadraticCurveTo(cp_x, bottom_cp_y, params.first_x_px + first_x_shift, first_y_px);
|
|
25014
25139
|
ctx.closePath();
|
|
25015
25140
|
ctx.fill();
|
|
25141
|
+
ctx.closeGroup();
|
|
25016
25142
|
}
|
|
25017
25143
|
}
|
|
25018
25144
|
renderText(first_x_px, last_x_px) {
|
|
@@ -25529,8 +25655,10 @@ class StemmableNote extends _note__WEBPACK_IMPORTED_MODULE_1__.Note {
|
|
|
25529
25655
|
if (this.beam) {
|
|
25530
25656
|
return glyph.stem_beam_extension;
|
|
25531
25657
|
}
|
|
25532
|
-
|
|
25533
|
-
|
|
25658
|
+
if (glyph) {
|
|
25659
|
+
return this.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_2__.Stem.UP ? glyph.stem_up_extension : glyph.stem_down_extension;
|
|
25660
|
+
}
|
|
25661
|
+
return 0;
|
|
25534
25662
|
}
|
|
25535
25663
|
// Set the stem length to a specific. Will override the default length.
|
|
25536
25664
|
setStemLength(height) {
|
|
@@ -27597,6 +27725,10 @@ const durationCodes = {
|
|
|
27597
27725
|
stem: false,
|
|
27598
27726
|
stem_offset: 0,
|
|
27599
27727
|
flag: false,
|
|
27728
|
+
stem_up_extension: -Tables.STEM_HEIGHT,
|
|
27729
|
+
stem_down_extension: -Tables.STEM_HEIGHT,
|
|
27730
|
+
tabnote_stem_up_extension: -Tables.STEM_HEIGHT,
|
|
27731
|
+
tabnote_stem_down_extension: -Tables.STEM_HEIGHT,
|
|
27600
27732
|
dot_shiftY: 0,
|
|
27601
27733
|
line_above: 0,
|
|
27602
27734
|
line_below: 0,
|
|
@@ -27651,6 +27783,10 @@ const durationCodes = {
|
|
|
27651
27783
|
stem: false,
|
|
27652
27784
|
stem_offset: 0,
|
|
27653
27785
|
flag: false,
|
|
27786
|
+
stem_up_extension: -Tables.STEM_HEIGHT,
|
|
27787
|
+
stem_down_extension: -Tables.STEM_HEIGHT,
|
|
27788
|
+
tabnote_stem_up_extension: -Tables.STEM_HEIGHT,
|
|
27789
|
+
tabnote_stem_down_extension: -Tables.STEM_HEIGHT,
|
|
27654
27790
|
dot_shiftY: 0,
|
|
27655
27791
|
line_above: 0,
|
|
27656
27792
|
line_below: 0,
|
|
@@ -27705,6 +27841,10 @@ const durationCodes = {
|
|
|
27705
27841
|
stem: true,
|
|
27706
27842
|
stem_offset: 0,
|
|
27707
27843
|
flag: false,
|
|
27844
|
+
stem_up_extension: 0,
|
|
27845
|
+
stem_down_extension: 0,
|
|
27846
|
+
tabnote_stem_up_extension: 0,
|
|
27847
|
+
tabnote_stem_down_extension: 0,
|
|
27708
27848
|
dot_shiftY: 0,
|
|
27709
27849
|
line_above: 0,
|
|
27710
27850
|
line_below: 0,
|
|
@@ -27760,6 +27900,10 @@ const durationCodes = {
|
|
|
27760
27900
|
stem: true,
|
|
27761
27901
|
stem_offset: 0,
|
|
27762
27902
|
flag: false,
|
|
27903
|
+
stem_up_extension: 0,
|
|
27904
|
+
stem_down_extension: 0,
|
|
27905
|
+
tabnote_stem_up_extension: 0,
|
|
27906
|
+
tabnote_stem_down_extension: 0,
|
|
27763
27907
|
dot_shiftY: 0,
|
|
27764
27908
|
line_above: 0,
|
|
27765
27909
|
line_below: 0,
|
|
@@ -27820,6 +27964,10 @@ const durationCodes = {
|
|
|
27820
27964
|
stem_beam_extension: 0,
|
|
27821
27965
|
code_flag_upstem: 'flag8thUp',
|
|
27822
27966
|
code_flag_downstem: 'flag8thDown',
|
|
27967
|
+
stem_up_extension: 0,
|
|
27968
|
+
stem_down_extension: 0,
|
|
27969
|
+
tabnote_stem_up_extension: 0,
|
|
27970
|
+
tabnote_stem_down_extension: 0,
|
|
27823
27971
|
dot_shiftY: 0,
|
|
27824
27972
|
line_above: 0,
|
|
27825
27973
|
line_below: 0,
|
|
@@ -27881,6 +28029,10 @@ const durationCodes = {
|
|
|
27881
28029
|
flag: true,
|
|
27882
28030
|
code_flag_upstem: 'flag16thUp',
|
|
27883
28031
|
code_flag_downstem: 'flag16thDown',
|
|
28032
|
+
stem_up_extension: 0,
|
|
28033
|
+
stem_down_extension: 0,
|
|
28034
|
+
tabnote_stem_up_extension: 0,
|
|
28035
|
+
tabnote_stem_down_extension: 0,
|
|
27884
28036
|
dot_shiftY: 0,
|
|
27885
28037
|
line_above: 0,
|
|
27886
28038
|
line_below: 0,
|
|
@@ -27942,6 +28094,10 @@ const durationCodes = {
|
|
|
27942
28094
|
flag: true,
|
|
27943
28095
|
code_flag_upstem: 'flag32ndUp',
|
|
27944
28096
|
code_flag_downstem: 'flag32ndDown',
|
|
28097
|
+
stem_up_extension: 9,
|
|
28098
|
+
stem_down_extension: 9,
|
|
28099
|
+
tabnote_stem_up_extension: 9,
|
|
28100
|
+
tabnote_stem_down_extension: 9,
|
|
27945
28101
|
dot_shiftY: 0,
|
|
27946
28102
|
line_above: 0,
|
|
27947
28103
|
line_below: 0,
|
|
@@ -28003,6 +28159,10 @@ const durationCodes = {
|
|
|
28003
28159
|
flag: true,
|
|
28004
28160
|
code_flag_upstem: 'flag64thUp',
|
|
28005
28161
|
code_flag_downstem: 'flag64thDown',
|
|
28162
|
+
stem_up_extension: 13,
|
|
28163
|
+
stem_down_extension: 13,
|
|
28164
|
+
tabnote_stem_up_extension: 13,
|
|
28165
|
+
tabnote_stem_down_extension: 13,
|
|
28006
28166
|
dot_shiftY: 0,
|
|
28007
28167
|
line_above: 0,
|
|
28008
28168
|
line_below: 0,
|
|
@@ -28064,6 +28224,10 @@ const durationCodes = {
|
|
|
28064
28224
|
flag: true,
|
|
28065
28225
|
code_flag_upstem: 'flag128thUp',
|
|
28066
28226
|
code_flag_downstem: 'flag128thDown',
|
|
28227
|
+
stem_up_extension: 22,
|
|
28228
|
+
stem_down_extension: 22,
|
|
28229
|
+
tabnote_stem_up_extension: 22,
|
|
28230
|
+
tabnote_stem_down_extension: 22,
|
|
28067
28231
|
dot_shiftY: 0,
|
|
28068
28232
|
line_above: 0,
|
|
28069
28233
|
line_below: 0,
|
|
@@ -28306,11 +28470,12 @@ class TabNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNote
|
|
|
28306
28470
|
}
|
|
28307
28471
|
// Get the default stem extension for the note
|
|
28308
28472
|
getStemExtension() {
|
|
28473
|
+
const glyph = this.getGlyph();
|
|
28309
28474
|
if (this.stem_extension_override != null) {
|
|
28310
28475
|
return this.stem_extension_override;
|
|
28311
28476
|
}
|
|
28312
|
-
if (
|
|
28313
|
-
return this.getStemDirection() ===
|
|
28477
|
+
if (glyph) {
|
|
28478
|
+
return this.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_3__.Stem.UP ? glyph.tabnote_stem_up_extension : glyph.tabnote_stem_down_extension;
|
|
28314
28479
|
}
|
|
28315
28480
|
return 0;
|
|
28316
28481
|
}
|
|
@@ -28426,18 +28591,22 @@ class TabNote extends _stemmablenote__WEBPACK_IMPORTED_MODULE_4__.StemmableNote
|
|
|
28426
28591
|
}
|
|
28427
28592
|
// Draw the fal onto the context
|
|
28428
28593
|
drawFlag() {
|
|
28429
|
-
|
|
28594
|
+
var _a;
|
|
28595
|
+
const { beam, glyph, render_options: { draw_stem }, } = this;
|
|
28430
28596
|
const context = this.checkContext();
|
|
28431
28597
|
const shouldDrawFlag = beam == undefined && draw_stem;
|
|
28432
28598
|
// Now it's the flag's turn.
|
|
28433
28599
|
if (glyph.flag && shouldDrawFlag) {
|
|
28434
|
-
const flag_x = this.getStemX()
|
|
28435
|
-
const flag_y = this.
|
|
28436
|
-
|
|
28437
|
-
|
|
28438
|
-
:
|
|
28600
|
+
const flag_x = this.getStemX();
|
|
28601
|
+
const flag_y = this.getStemDirection() === _stem__WEBPACK_IMPORTED_MODULE_3__.Stem.DOWN
|
|
28602
|
+
? // Down stems are below the note head and have flags on the right.
|
|
28603
|
+
this.getStemY() - this.checkStem().getHeight() - (this.glyph ? this.glyph.stem_down_extension : 0)
|
|
28604
|
+
: // Up stems are above the note head and have flags on the right.
|
|
28605
|
+
this.getStemY() - this.checkStem().getHeight() + (this.glyph ? this.glyph.stem_up_extension : 0);
|
|
28439
28606
|
// Draw the Flag
|
|
28440
|
-
|
|
28607
|
+
//this.flag?.setOptions({ category: 'flag.tabStem' });
|
|
28608
|
+
(_a = this.flag) === null || _a === void 0 ? void 0 : _a.render(context, flag_x, flag_y);
|
|
28609
|
+
//Glyph.renderGlyph(context, flag_x, flag_y, glyph_font_scale, flag_code, { category: 'flag.tabStem' });
|
|
28441
28610
|
}
|
|
28442
28611
|
}
|
|
28443
28612
|
// Render the modifiers onto the context.
|