@tspro/web-music-score 5.4.2 → 5.5.1
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/CHANGELOG.md +15 -0
- package/LICENSE +24 -0
- package/README.md +8 -546
- package/dist/audio/index.d.ts +1 -1
- package/dist/audio/index.js +1748 -5
- package/dist/audio/index.mjs +9 -6
- package/dist/audio-cg/index.js +17487 -46
- package/dist/audio-cg/index.mjs +7 -5
- package/dist/audio-synth/index.js +18434 -32
- package/dist/audio-synth/index.mjs +12 -7
- package/dist/chunk-7GVRGM3N.mjs +101 -0
- package/dist/chunk-AUOH7S2E.mjs +3877 -0
- package/dist/{chunk-MMWSQGVR.mjs → chunk-BZE5UGTJ.mjs} +3 -3
- package/dist/{chunk-CVYTUTL6.mjs → chunk-FLBNOYUN.mjs} +2 -2
- package/dist/{chunk-42IBAVOC.mjs → chunk-KKIFSIFK.mjs} +18 -13
- package/dist/chunk-L7VPSGMT.mjs +18381 -0
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +4 -4
- package/dist/{guitar-CNOxM4ZK.d.ts → guitar-CarHGDAt.d.ts} +1 -1
- package/dist/iife/audio-cg.global.js +1 -1
- package/dist/iife/index.global.js +13 -13
- package/dist/{music-objects-DqoO-Sfv.d.mts → music-objects-CcJvZxS6.d.mts} +123 -96
- package/dist/{music-objects-T8u8bnNP.d.ts → music-objects-l5Ai97QA.d.ts} +125 -98
- package/dist/{note-RVXvpfyV.d.ts → note-CJuq5aBy.d.ts} +1 -1
- package/dist/pieces/index.d.mts +12 -6
- package/dist/pieces/index.d.ts +14 -8
- package/dist/pieces/index.js +25 -13
- package/dist/pieces/index.mjs +25 -14
- package/dist/react-ui/index.d.mts +1 -1
- package/dist/react-ui/index.d.ts +5 -5
- package/dist/react-ui/index.js +2274 -22
- package/dist/react-ui/index.mjs +18 -15
- package/dist/{scale-CUYFBo-8.d.ts → scale-DulPFco_.d.ts} +2 -2
- package/dist/score/index.d.mts +51 -3
- package/dist/score/index.d.ts +54 -6
- package/dist/score/index.js +4941 -872
- package/dist/score/index.mjs +1282 -729
- package/dist/{tempo-DwuZsv2T.d.ts → tempo-BnUjm25M.d.ts} +1 -1
- package/dist/theory/index.d.ts +6 -6
- package/dist/theory/index.js +2687 -136
- package/dist/theory/index.mjs +41 -49
- package/package.json +4 -5
- package/dist/chunk-ROBXPR34.mjs +0 -9
package/dist/score/index.mjs
CHANGED
|
@@ -1,18 +1,126 @@
|
|
|
1
|
-
/* WebMusicScore v5.
|
|
1
|
+
/* WebMusicScore v5.5.1 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
2
|
import {
|
|
3
3
|
MusicError
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-BZE5UGTJ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
NoteLengthProps,
|
|
7
7
|
RhythmProps,
|
|
8
8
|
validateNoteLength
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-KKIFSIFK.mjs";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
AnchoredRect,
|
|
12
|
+
BiMap,
|
|
13
|
+
IndexArray,
|
|
14
|
+
Rect,
|
|
15
|
+
TriMap,
|
|
16
|
+
UniMap,
|
|
17
|
+
ValueSet,
|
|
18
|
+
Vec,
|
|
19
|
+
asMulti,
|
|
20
|
+
device_exports,
|
|
21
|
+
guard_exports,
|
|
22
|
+
utils_exports
|
|
23
|
+
} from "../chunk-AUOH7S2E.mjs";
|
|
24
|
+
import {
|
|
25
|
+
__publicField,
|
|
26
|
+
__spreadProps,
|
|
27
|
+
__spreadValues
|
|
28
|
+
} from "../chunk-7GVRGM3N.mjs";
|
|
29
|
+
|
|
30
|
+
// src/score/engine/settings.ts
|
|
31
|
+
var DebugSettings = {
|
|
32
|
+
DrawDebugRects: false,
|
|
33
|
+
DisableBeams: false
|
|
34
|
+
};
|
|
35
|
+
var DocumentSettings = {
|
|
36
|
+
DocumentScale: 1,
|
|
37
|
+
MinStaffWidth: 75,
|
|
38
|
+
MinColumnsWidth: 10,
|
|
39
|
+
ColumnWidthScale: 1.7,
|
|
40
|
+
PostMeasureBreakWidth: 10,
|
|
41
|
+
NoteDotSpace: 0.5,
|
|
42
|
+
NoteAccSpace: 0.5,
|
|
43
|
+
NoteHeadWidth: 2,
|
|
44
|
+
NoteHeadHeight: 1.3,
|
|
45
|
+
DiamondNoteHeadSize: 1.8,
|
|
46
|
+
DotSize: 0.8,
|
|
47
|
+
StemHeight: 7,
|
|
48
|
+
// One octave
|
|
49
|
+
FlagWidth: 1.5,
|
|
50
|
+
FlagHeight: 4,
|
|
51
|
+
FlagSeparation: 2,
|
|
52
|
+
BeamSeparation: 1.25,
|
|
53
|
+
BeamAngleFactor: 0.5,
|
|
54
|
+
BeamThickness: 4,
|
|
55
|
+
RestDotSpace: 0.5,
|
|
56
|
+
LedgerLineWidth: 3.6,
|
|
57
|
+
StubTieLength: 5,
|
|
58
|
+
StaffHeight: 8,
|
|
59
|
+
TabHeight: 20
|
|
60
|
+
};
|
|
61
|
+
var DocumentColor = {
|
|
62
|
+
HilightStaffPos: "#55cc55",
|
|
63
|
+
HilightObject: "#55cc55",
|
|
64
|
+
PlayCursor: "#44aa44",
|
|
65
|
+
Background: "white",
|
|
66
|
+
Header_Title: "black",
|
|
67
|
+
Header_Composer: "black",
|
|
68
|
+
Header_Arranger: "black",
|
|
69
|
+
RowGroup_Instrument: "black",
|
|
70
|
+
RowGroup_Frame: "black",
|
|
71
|
+
Staff_Frame: "black",
|
|
72
|
+
Staff_Note: "black",
|
|
73
|
+
Staff_Rest: "black",
|
|
74
|
+
Staff_Connective: "black",
|
|
75
|
+
Staff_Signature_Clef: "black",
|
|
76
|
+
Staff_Signature_Key: "black",
|
|
77
|
+
Staff_Signature_Time: "black",
|
|
78
|
+
Staff_Signature_Tempo: "black",
|
|
79
|
+
Staff_Signature_MeasureNum: "black",
|
|
80
|
+
Staff_Element_Fermata: "black",
|
|
81
|
+
Staff_Element_Annotation: "black",
|
|
82
|
+
Staff_Element_Navigation: "black",
|
|
83
|
+
Staff_Element_Label: "black",
|
|
84
|
+
Tab_Frame: "black",
|
|
85
|
+
Tab_Note: "black",
|
|
86
|
+
Tab_Rest: "black",
|
|
87
|
+
Tab_Connective: "black",
|
|
88
|
+
Tab_Tuning: "black",
|
|
89
|
+
//Tab_Signature_Clef: "black",
|
|
90
|
+
//Tab_Signature_Key: "black",
|
|
91
|
+
Tab_Signature_Time: "black",
|
|
92
|
+
Tab_Signature_Tempo: "black",
|
|
93
|
+
Tab_Signature_MeasureNum: "black",
|
|
94
|
+
Tab_Element_Fermata: "black",
|
|
95
|
+
Tab_Element_Annotation: "black",
|
|
96
|
+
Tab_Element_Navigation: "black",
|
|
97
|
+
Tab_Element_Label: "black"
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// src/score/pub/color.ts
|
|
101
|
+
function eq(a, b) {
|
|
102
|
+
return a.toLocaleLowerCase() === b.toLocaleLowerCase();
|
|
103
|
+
}
|
|
104
|
+
function setColor(color, ...colorAttrs) {
|
|
105
|
+
const setBacground = colorAttrs.length === 1 && eq(colorAttrs[0], "background");
|
|
106
|
+
const setAllColors = colorAttrs.length === 0;
|
|
107
|
+
if (eq(color, ""))
|
|
108
|
+
color = setBacground ? "white" : "black";
|
|
109
|
+
let noMatch = true;
|
|
110
|
+
for (const key in DocumentColor) {
|
|
111
|
+
const keyAttrs = key.split("_");
|
|
112
|
+
const isColorMatch = colorAttrs.length > 0 && colorAttrs.every((a) => keyAttrs.some((b) => eq(a, b)));
|
|
113
|
+
const isBgColorMatch = keyAttrs.length === 1 && eq(keyAttrs[0], "background");
|
|
114
|
+
if (setAllColors && !isBgColorMatch || isColorMatch) {
|
|
115
|
+
DocumentColor[key] = color;
|
|
116
|
+
noMatch = false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (noMatch)
|
|
120
|
+
console.error(`Color attrs ${utils_exports.Str.stringify(colorAttrs)} did not match any color.`);
|
|
121
|
+
}
|
|
13
122
|
|
|
14
123
|
// src/score/pub/div-rect.ts
|
|
15
|
-
import { Utils } from "@tspro/ts-utils-lib";
|
|
16
124
|
var DivRect = class _DivRect {
|
|
17
125
|
constructor(...args) {
|
|
18
126
|
__publicField(this, "left");
|
|
@@ -284,10 +392,10 @@ var DivRect = class _DivRect {
|
|
|
284
392
|
clipInPlace(clipRect) {
|
|
285
393
|
this.left = Math.max(this.left, clipRect.left);
|
|
286
394
|
this.right = Math.min(this.right, clipRect.right);
|
|
287
|
-
this.anchorX =
|
|
395
|
+
this.anchorX = utils_exports.Math.clamp(this.anchorX, this.left, this.right);
|
|
288
396
|
this.top = Math.max(this.top, clipRect.top);
|
|
289
397
|
this.bottom = Math.min(this.bottom, clipRect.bottom);
|
|
290
|
-
this.anchorY =
|
|
398
|
+
this.anchorY = utils_exports.Math.clamp(this.anchorY, this.top, this.bottom);
|
|
291
399
|
return this;
|
|
292
400
|
}
|
|
293
401
|
/**
|
|
@@ -333,11 +441,7 @@ var DivRect = class _DivRect {
|
|
|
333
441
|
}
|
|
334
442
|
};
|
|
335
443
|
|
|
336
|
-
// src/score/pub/document-builder.ts
|
|
337
|
-
import { Guard as Guard12, Utils as Utils12 } from "@tspro/ts-utils-lib";
|
|
338
|
-
|
|
339
444
|
// src/score/pub/types.ts
|
|
340
|
-
import { Guard } from "@tspro/ts-utils-lib";
|
|
341
445
|
var StaffPreset = /* @__PURE__ */ ((StaffPreset2) => {
|
|
342
446
|
StaffPreset2["Treble"] = "treble";
|
|
343
447
|
StaffPreset2["Bass"] = "bass";
|
|
@@ -356,7 +460,7 @@ function getVoiceIds() {
|
|
|
356
460
|
return [0, 1, 2, 3];
|
|
357
461
|
}
|
|
358
462
|
function isVoiceId(voiceId) {
|
|
359
|
-
return
|
|
463
|
+
return guard_exports.isIncluded(voiceId, getVoiceIds());
|
|
360
464
|
}
|
|
361
465
|
function validateVoiceId(voiceId) {
|
|
362
466
|
if (isVoiceId(voiceId)) {
|
|
@@ -369,7 +473,7 @@ function getStringNumbers() {
|
|
|
369
473
|
return [1, 2, 3, 4, 5, 6];
|
|
370
474
|
}
|
|
371
475
|
function isStringNumber(stringNum) {
|
|
372
|
-
return
|
|
476
|
+
return guard_exports.isIncluded(stringNum, getStringNumbers());
|
|
373
477
|
}
|
|
374
478
|
function validateStringNumber(stringNum) {
|
|
375
479
|
if (isStringNumber(stringNum)) {
|
|
@@ -382,7 +486,7 @@ function getVerseNumbers() {
|
|
|
382
486
|
return [1, 2, 3];
|
|
383
487
|
}
|
|
384
488
|
function isVerseNumber(verse) {
|
|
385
|
-
return
|
|
489
|
+
return guard_exports.isIncluded(verse, getVerseNumbers());
|
|
386
490
|
}
|
|
387
491
|
function validateVerseNumber(verseNum) {
|
|
388
492
|
if (isVerseNumber(verseNum)) {
|
|
@@ -497,7 +601,6 @@ var PlayState = /* @__PURE__ */ ((PlayState2) => {
|
|
|
497
601
|
})(PlayState || {});
|
|
498
602
|
|
|
499
603
|
// src/score/engine/music-object.ts
|
|
500
|
-
import { AnchoredRect } from "@tspro/ts-utils-lib";
|
|
501
604
|
var MusicObjectLink = class {
|
|
502
605
|
constructor(head) {
|
|
503
606
|
__publicField(this, "head");
|
|
@@ -526,6 +629,7 @@ var MusicObject = class {
|
|
|
526
629
|
this.parent = parent;
|
|
527
630
|
__publicField(this, "anchoredLayoutObjects", []);
|
|
528
631
|
__publicField(this, "link");
|
|
632
|
+
__publicField(this, "userData", {});
|
|
529
633
|
__publicField(this, "rect", new AnchoredRect());
|
|
530
634
|
__publicField(this, "needRectUpdate", true);
|
|
531
635
|
}
|
|
@@ -616,58 +720,413 @@ import { Note as Note9 } from "@tspro/web-music-score/theory";
|
|
|
616
720
|
// src/score/engine/obj-staff-and-tab.ts
|
|
617
721
|
import { getTuningStrings, Note as Note8, validateTuningName } from "@tspro/web-music-score/theory";
|
|
618
722
|
|
|
619
|
-
//
|
|
620
|
-
|
|
723
|
+
// node_modules/color-name-to-code/dist/color-name.enum.js
|
|
724
|
+
var ColorName;
|
|
725
|
+
(function(ColorName2) {
|
|
726
|
+
ColorName2["AliceBlue"] = "aliceblue";
|
|
727
|
+
ColorName2["AntiqueWhite"] = "antiquewhite";
|
|
728
|
+
ColorName2["Aqua"] = "aqua";
|
|
729
|
+
ColorName2["Aquamarine"] = "aquamarine";
|
|
730
|
+
ColorName2["Azure"] = "azure";
|
|
731
|
+
ColorName2["Beige"] = "beige";
|
|
732
|
+
ColorName2["Bisque"] = "bisque";
|
|
733
|
+
ColorName2["Black"] = "black";
|
|
734
|
+
ColorName2["BlanchedAlmond"] = "blanchedalmond";
|
|
735
|
+
ColorName2["Blue"] = "blue";
|
|
736
|
+
ColorName2["BlueViolet"] = "blueviolet";
|
|
737
|
+
ColorName2["Brown"] = "brown";
|
|
738
|
+
ColorName2["BurlyWood"] = "burlywood";
|
|
739
|
+
ColorName2["CadetBlue"] = "cadetblue";
|
|
740
|
+
ColorName2["Chartreuse"] = "chartreuse";
|
|
741
|
+
ColorName2["Chocolate"] = "chocolate";
|
|
742
|
+
ColorName2["Coral"] = "coral";
|
|
743
|
+
ColorName2["CornflowerBlue"] = "cornflowerblue";
|
|
744
|
+
ColorName2["CornSilk"] = "cornsilk";
|
|
745
|
+
ColorName2["Crimson"] = "crimson";
|
|
746
|
+
ColorName2["Cyan"] = "cyan";
|
|
747
|
+
ColorName2["DarkBlue"] = "darkblue";
|
|
748
|
+
ColorName2["DarkCyan"] = "darkcyan";
|
|
749
|
+
ColorName2["DarkGoldenRod"] = "darkgoldenrod";
|
|
750
|
+
ColorName2["DarkGray"] = "darkgray";
|
|
751
|
+
ColorName2["DarkGreen"] = "darkgreen";
|
|
752
|
+
ColorName2["DarkGrey"] = "darkgrey";
|
|
753
|
+
ColorName2["DarkKhaki"] = "darkkhaki";
|
|
754
|
+
ColorName2["DarkMagenta"] = "darkmagenta";
|
|
755
|
+
ColorName2["DarkOliveGreen"] = "darkolivegreen";
|
|
756
|
+
ColorName2["DarkOrange"] = "darkorange";
|
|
757
|
+
ColorName2["DarkOrchid"] = "darkorchid";
|
|
758
|
+
ColorName2["DarkRed"] = "darkred";
|
|
759
|
+
ColorName2["DarkSalmon"] = "darksalmon";
|
|
760
|
+
ColorName2["DarkSeaGreen"] = "darkseagreen";
|
|
761
|
+
ColorName2["DarkSlateBlue"] = "darkslateblue";
|
|
762
|
+
ColorName2["DarkSlateGray"] = "darkslategray";
|
|
763
|
+
ColorName2["DarkSlateGrey"] = "darkslategrey";
|
|
764
|
+
ColorName2["DarkTurquoise"] = "darkturquoise";
|
|
765
|
+
ColorName2["DarkViolet"] = "darkviolet";
|
|
766
|
+
ColorName2["DeepPink"] = "deeppink";
|
|
767
|
+
ColorName2["DeepSkyBlue"] = "deepskyblue";
|
|
768
|
+
ColorName2["DimGray"] = "dimgray";
|
|
769
|
+
ColorName2["DimGrey"] = "dimgrey";
|
|
770
|
+
ColorName2["DodgerBlue"] = "dodgerblue";
|
|
771
|
+
ColorName2["FireBrick"] = "firebrick";
|
|
772
|
+
ColorName2["FloralWhite"] = "floralwhite";
|
|
773
|
+
ColorName2["ForestGreen"] = "forestgreen";
|
|
774
|
+
ColorName2["Fuchsia"] = "fuchsia";
|
|
775
|
+
ColorName2["Gainsboro"] = "gainsboro";
|
|
776
|
+
ColorName2["GhostWhite"] = "ghostwhite";
|
|
777
|
+
ColorName2["Gold"] = "gold";
|
|
778
|
+
ColorName2["GoldenRod"] = "goldenrod";
|
|
779
|
+
ColorName2["Gray"] = "gray";
|
|
780
|
+
ColorName2["Green"] = "green";
|
|
781
|
+
ColorName2["GreenYellow"] = "greenyellow";
|
|
782
|
+
ColorName2["Grey"] = "grey";
|
|
783
|
+
ColorName2["Honeydew"] = "honeydew";
|
|
784
|
+
ColorName2["HotPink"] = "hotpink";
|
|
785
|
+
ColorName2["IndianRed"] = "indianred";
|
|
786
|
+
ColorName2["Indigo"] = "indigo";
|
|
787
|
+
ColorName2["Ivory"] = "ivory";
|
|
788
|
+
ColorName2["Khaki"] = "khaki";
|
|
789
|
+
ColorName2["Lavender"] = "lavender";
|
|
790
|
+
ColorName2["LavenderBlush"] = "lavenderblush";
|
|
791
|
+
ColorName2["LawnGreen"] = "lawngreen";
|
|
792
|
+
ColorName2["LemonChiffon"] = "lemonchiffon";
|
|
793
|
+
ColorName2["LightBlue"] = "lightblue";
|
|
794
|
+
ColorName2["LightCoral"] = "lightcoral";
|
|
795
|
+
ColorName2["LightCyan"] = "lightcyan";
|
|
796
|
+
ColorName2["LightGoldenRodYellow"] = "lightgoldenrodyellow";
|
|
797
|
+
ColorName2["LightGray"] = "lightgray";
|
|
798
|
+
ColorName2["LightGreen"] = "lightgreen";
|
|
799
|
+
ColorName2["LightGrey"] = "lightgrey";
|
|
800
|
+
ColorName2["LightPink"] = "lightpink";
|
|
801
|
+
ColorName2["LightSalmon"] = "lightsalmon";
|
|
802
|
+
ColorName2["LightSeaGreen"] = "lightseagreen";
|
|
803
|
+
ColorName2["LightSkyBlue"] = "lightskyblue";
|
|
804
|
+
ColorName2["LightSlateGray"] = "lightslategray";
|
|
805
|
+
ColorName2["LightSlateGrey"] = "lightslategrey";
|
|
806
|
+
ColorName2["LightSteelBlue"] = "lightsteelblue";
|
|
807
|
+
ColorName2["LightYellow"] = "lightyellow";
|
|
808
|
+
ColorName2["Lime"] = "lime";
|
|
809
|
+
ColorName2["LimeGreen"] = "limegreen";
|
|
810
|
+
ColorName2["Linen"] = "linen";
|
|
811
|
+
ColorName2["Magenta"] = "magenta";
|
|
812
|
+
ColorName2["Maroon"] = "maroon";
|
|
813
|
+
ColorName2["MediumAquamarine"] = "mediumaquamarine";
|
|
814
|
+
ColorName2["MediumBlue"] = "mediumblue";
|
|
815
|
+
ColorName2["MediumOrchid"] = "mediumorchid";
|
|
816
|
+
ColorName2["MediumPurple"] = "mediumpurple";
|
|
817
|
+
ColorName2["MediumSeaGreen"] = "mediumseagreen";
|
|
818
|
+
ColorName2["MediumSlateBlue"] = "mediumslateblue";
|
|
819
|
+
ColorName2["MediumSpringGreen"] = "mediumspringgreen";
|
|
820
|
+
ColorName2["MediumTurquoise"] = "mediumturquoise";
|
|
821
|
+
ColorName2["MediumVioletRed"] = "mediumvioletred";
|
|
822
|
+
ColorName2["MidnightBlue"] = "midnightblue";
|
|
823
|
+
ColorName2["MintCream"] = "mintcream";
|
|
824
|
+
ColorName2["MistyRose"] = "mistyrose";
|
|
825
|
+
ColorName2["Moccasin"] = "moccasin";
|
|
826
|
+
ColorName2["NavajoWhite"] = "navajowhite";
|
|
827
|
+
ColorName2["Navy"] = "navy";
|
|
828
|
+
ColorName2["OldLace"] = "oldlace";
|
|
829
|
+
ColorName2["Olive"] = "olive";
|
|
830
|
+
ColorName2["OliveDrab"] = "olivedrab";
|
|
831
|
+
ColorName2["Orange"] = "orange";
|
|
832
|
+
ColorName2["OrangeRed"] = "orangered";
|
|
833
|
+
ColorName2["Orchid"] = "orchid";
|
|
834
|
+
ColorName2["PaleGoldenRod"] = "palegoldenrod";
|
|
835
|
+
ColorName2["PaleGreen"] = "palegreen";
|
|
836
|
+
ColorName2["PaleTurquoise"] = "paleturquoise";
|
|
837
|
+
ColorName2["PaleVioletRed"] = "palevioletred";
|
|
838
|
+
ColorName2["PapayaWhip"] = "papayawhip";
|
|
839
|
+
ColorName2["PeachPuff"] = "peachpuff";
|
|
840
|
+
ColorName2["Peru"] = "peru";
|
|
841
|
+
ColorName2["Pink"] = "pink";
|
|
842
|
+
ColorName2["Plum"] = "plum";
|
|
843
|
+
ColorName2["PowderBlue"] = "powderblue";
|
|
844
|
+
ColorName2["Purple"] = "purple";
|
|
845
|
+
ColorName2["RebeccaPurple"] = "rebeccapurple";
|
|
846
|
+
ColorName2["Red"] = "red";
|
|
847
|
+
ColorName2["RosyBrown"] = "rosybrown";
|
|
848
|
+
ColorName2["RoyalBlue"] = "royalblue";
|
|
849
|
+
ColorName2["SaddleBrown"] = "saddlebrown";
|
|
850
|
+
ColorName2["Salmon"] = "salmon";
|
|
851
|
+
ColorName2["SandyBrown"] = "sandybrown";
|
|
852
|
+
ColorName2["SeaGreen"] = "seagreen";
|
|
853
|
+
ColorName2["SeaShell"] = "seashell";
|
|
854
|
+
ColorName2["Sienna"] = "sienna";
|
|
855
|
+
ColorName2["Silver"] = "silver";
|
|
856
|
+
ColorName2["SkyBlue"] = "skyblue";
|
|
857
|
+
ColorName2["SlateBlue"] = "slateblue";
|
|
858
|
+
ColorName2["SlateGray"] = "slategray";
|
|
859
|
+
ColorName2["SlateGrey"] = "slategrey";
|
|
860
|
+
ColorName2["Snow"] = "snow";
|
|
861
|
+
ColorName2["SpringGreen"] = "springgreen";
|
|
862
|
+
ColorName2["SteelBlue"] = "steelblue";
|
|
863
|
+
ColorName2["Tan"] = "tan";
|
|
864
|
+
ColorName2["Teal"] = "teal";
|
|
865
|
+
ColorName2["Thistle"] = "thistle";
|
|
866
|
+
ColorName2["Tomato"] = "tomato";
|
|
867
|
+
ColorName2["Turquoise"] = "turquoise";
|
|
868
|
+
ColorName2["Violet"] = "violet";
|
|
869
|
+
ColorName2["Wheat"] = "wheat";
|
|
870
|
+
ColorName2["White"] = "white";
|
|
871
|
+
ColorName2["WhiteSmoke"] = "whitesmoke";
|
|
872
|
+
ColorName2["Yellow"] = "yellow";
|
|
873
|
+
ColorName2["YellowGreen"] = "yellowgreen";
|
|
874
|
+
})(ColorName = ColorName || (ColorName = {}));
|
|
621
875
|
|
|
622
|
-
//
|
|
623
|
-
var
|
|
624
|
-
|
|
625
|
-
|
|
876
|
+
// node_modules/color-name-to-code/dist/color-code-format.enum.js
|
|
877
|
+
var ColorCodeFormat;
|
|
878
|
+
(function(ColorCodeFormat2) {
|
|
879
|
+
ColorCodeFormat2["Hex"] = "hex";
|
|
880
|
+
ColorCodeFormat2["RGB"] = "rgb";
|
|
881
|
+
ColorCodeFormat2["Array"] = "array";
|
|
882
|
+
})(ColorCodeFormat = ColorCodeFormat || (ColorCodeFormat = {}));
|
|
883
|
+
|
|
884
|
+
// node_modules/color-name/index.js
|
|
885
|
+
var colors = {
|
|
886
|
+
aliceblue: [240, 248, 255],
|
|
887
|
+
antiquewhite: [250, 235, 215],
|
|
888
|
+
aqua: [0, 255, 255],
|
|
889
|
+
aquamarine: [127, 255, 212],
|
|
890
|
+
azure: [240, 255, 255],
|
|
891
|
+
beige: [245, 245, 220],
|
|
892
|
+
bisque: [255, 228, 196],
|
|
893
|
+
black: [0, 0, 0],
|
|
894
|
+
blanchedalmond: [255, 235, 205],
|
|
895
|
+
blue: [0, 0, 255],
|
|
896
|
+
blueviolet: [138, 43, 226],
|
|
897
|
+
brown: [165, 42, 42],
|
|
898
|
+
burlywood: [222, 184, 135],
|
|
899
|
+
cadetblue: [95, 158, 160],
|
|
900
|
+
chartreuse: [127, 255, 0],
|
|
901
|
+
chocolate: [210, 105, 30],
|
|
902
|
+
coral: [255, 127, 80],
|
|
903
|
+
cornflowerblue: [100, 149, 237],
|
|
904
|
+
cornsilk: [255, 248, 220],
|
|
905
|
+
crimson: [220, 20, 60],
|
|
906
|
+
cyan: [0, 255, 255],
|
|
907
|
+
darkblue: [0, 0, 139],
|
|
908
|
+
darkcyan: [0, 139, 139],
|
|
909
|
+
darkgoldenrod: [184, 134, 11],
|
|
910
|
+
darkgray: [169, 169, 169],
|
|
911
|
+
darkgreen: [0, 100, 0],
|
|
912
|
+
darkgrey: [169, 169, 169],
|
|
913
|
+
darkkhaki: [189, 183, 107],
|
|
914
|
+
darkmagenta: [139, 0, 139],
|
|
915
|
+
darkolivegreen: [85, 107, 47],
|
|
916
|
+
darkorange: [255, 140, 0],
|
|
917
|
+
darkorchid: [153, 50, 204],
|
|
918
|
+
darkred: [139, 0, 0],
|
|
919
|
+
darksalmon: [233, 150, 122],
|
|
920
|
+
darkseagreen: [143, 188, 143],
|
|
921
|
+
darkslateblue: [72, 61, 139],
|
|
922
|
+
darkslategray: [47, 79, 79],
|
|
923
|
+
darkslategrey: [47, 79, 79],
|
|
924
|
+
darkturquoise: [0, 206, 209],
|
|
925
|
+
darkviolet: [148, 0, 211],
|
|
926
|
+
deeppink: [255, 20, 147],
|
|
927
|
+
deepskyblue: [0, 191, 255],
|
|
928
|
+
dimgray: [105, 105, 105],
|
|
929
|
+
dimgrey: [105, 105, 105],
|
|
930
|
+
dodgerblue: [30, 144, 255],
|
|
931
|
+
firebrick: [178, 34, 34],
|
|
932
|
+
floralwhite: [255, 250, 240],
|
|
933
|
+
forestgreen: [34, 139, 34],
|
|
934
|
+
fuchsia: [255, 0, 255],
|
|
935
|
+
gainsboro: [220, 220, 220],
|
|
936
|
+
ghostwhite: [248, 248, 255],
|
|
937
|
+
gold: [255, 215, 0],
|
|
938
|
+
goldenrod: [218, 165, 32],
|
|
939
|
+
gray: [128, 128, 128],
|
|
940
|
+
green: [0, 128, 0],
|
|
941
|
+
greenyellow: [173, 255, 47],
|
|
942
|
+
grey: [128, 128, 128],
|
|
943
|
+
honeydew: [240, 255, 240],
|
|
944
|
+
hotpink: [255, 105, 180],
|
|
945
|
+
indianred: [205, 92, 92],
|
|
946
|
+
indigo: [75, 0, 130],
|
|
947
|
+
ivory: [255, 255, 240],
|
|
948
|
+
khaki: [240, 230, 140],
|
|
949
|
+
lavender: [230, 230, 250],
|
|
950
|
+
lavenderblush: [255, 240, 245],
|
|
951
|
+
lawngreen: [124, 252, 0],
|
|
952
|
+
lemonchiffon: [255, 250, 205],
|
|
953
|
+
lightblue: [173, 216, 230],
|
|
954
|
+
lightcoral: [240, 128, 128],
|
|
955
|
+
lightcyan: [224, 255, 255],
|
|
956
|
+
lightgoldenrodyellow: [250, 250, 210],
|
|
957
|
+
lightgray: [211, 211, 211],
|
|
958
|
+
lightgreen: [144, 238, 144],
|
|
959
|
+
lightgrey: [211, 211, 211],
|
|
960
|
+
lightpink: [255, 182, 193],
|
|
961
|
+
lightsalmon: [255, 160, 122],
|
|
962
|
+
lightseagreen: [32, 178, 170],
|
|
963
|
+
lightskyblue: [135, 206, 250],
|
|
964
|
+
lightslategray: [119, 136, 153],
|
|
965
|
+
lightslategrey: [119, 136, 153],
|
|
966
|
+
lightsteelblue: [176, 196, 222],
|
|
967
|
+
lightyellow: [255, 255, 224],
|
|
968
|
+
lime: [0, 255, 0],
|
|
969
|
+
limegreen: [50, 205, 50],
|
|
970
|
+
linen: [250, 240, 230],
|
|
971
|
+
magenta: [255, 0, 255],
|
|
972
|
+
maroon: [128, 0, 0],
|
|
973
|
+
mediumaquamarine: [102, 205, 170],
|
|
974
|
+
mediumblue: [0, 0, 205],
|
|
975
|
+
mediumorchid: [186, 85, 211],
|
|
976
|
+
mediumpurple: [147, 112, 219],
|
|
977
|
+
mediumseagreen: [60, 179, 113],
|
|
978
|
+
mediumslateblue: [123, 104, 238],
|
|
979
|
+
mediumspringgreen: [0, 250, 154],
|
|
980
|
+
mediumturquoise: [72, 209, 204],
|
|
981
|
+
mediumvioletred: [199, 21, 133],
|
|
982
|
+
midnightblue: [25, 25, 112],
|
|
983
|
+
mintcream: [245, 255, 250],
|
|
984
|
+
mistyrose: [255, 228, 225],
|
|
985
|
+
moccasin: [255, 228, 181],
|
|
986
|
+
navajowhite: [255, 222, 173],
|
|
987
|
+
navy: [0, 0, 128],
|
|
988
|
+
oldlace: [253, 245, 230],
|
|
989
|
+
olive: [128, 128, 0],
|
|
990
|
+
olivedrab: [107, 142, 35],
|
|
991
|
+
orange: [255, 165, 0],
|
|
992
|
+
orangered: [255, 69, 0],
|
|
993
|
+
orchid: [218, 112, 214],
|
|
994
|
+
palegoldenrod: [238, 232, 170],
|
|
995
|
+
palegreen: [152, 251, 152],
|
|
996
|
+
paleturquoise: [175, 238, 238],
|
|
997
|
+
palevioletred: [219, 112, 147],
|
|
998
|
+
papayawhip: [255, 239, 213],
|
|
999
|
+
peachpuff: [255, 218, 185],
|
|
1000
|
+
peru: [205, 133, 63],
|
|
1001
|
+
pink: [255, 192, 203],
|
|
1002
|
+
plum: [221, 160, 221],
|
|
1003
|
+
powderblue: [176, 224, 230],
|
|
1004
|
+
purple: [128, 0, 128],
|
|
1005
|
+
rebeccapurple: [102, 51, 153],
|
|
1006
|
+
red: [255, 0, 0],
|
|
1007
|
+
rosybrown: [188, 143, 143],
|
|
1008
|
+
royalblue: [65, 105, 225],
|
|
1009
|
+
saddlebrown: [139, 69, 19],
|
|
1010
|
+
salmon: [250, 128, 114],
|
|
1011
|
+
sandybrown: [244, 164, 96],
|
|
1012
|
+
seagreen: [46, 139, 87],
|
|
1013
|
+
seashell: [255, 245, 238],
|
|
1014
|
+
sienna: [160, 82, 45],
|
|
1015
|
+
silver: [192, 192, 192],
|
|
1016
|
+
skyblue: [135, 206, 235],
|
|
1017
|
+
slateblue: [106, 90, 205],
|
|
1018
|
+
slategray: [112, 128, 144],
|
|
1019
|
+
slategrey: [112, 128, 144],
|
|
1020
|
+
snow: [255, 250, 250],
|
|
1021
|
+
springgreen: [0, 255, 127],
|
|
1022
|
+
steelblue: [70, 130, 180],
|
|
1023
|
+
tan: [210, 180, 140],
|
|
1024
|
+
teal: [0, 128, 128],
|
|
1025
|
+
thistle: [216, 191, 216],
|
|
1026
|
+
tomato: [255, 99, 71],
|
|
1027
|
+
turquoise: [64, 224, 208],
|
|
1028
|
+
violet: [238, 130, 238],
|
|
1029
|
+
wheat: [245, 222, 179],
|
|
1030
|
+
white: [255, 255, 255],
|
|
1031
|
+
whitesmoke: [245, 245, 245],
|
|
1032
|
+
yellow: [255, 255, 0],
|
|
1033
|
+
yellowgreen: [154, 205, 50]
|
|
626
1034
|
};
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
DotSize: 0.8,
|
|
639
|
-
StemHeight: 7,
|
|
640
|
-
// One octave
|
|
641
|
-
FlagWidth: 1.5,
|
|
642
|
-
FlagHeight: 4,
|
|
643
|
-
FlagSeparation: 2,
|
|
644
|
-
BeamSeparation: 1.25,
|
|
645
|
-
BeamAngleFactor: 0.5,
|
|
646
|
-
BeamThickness: 4,
|
|
647
|
-
RestDotSpace: 0.5,
|
|
648
|
-
LedgerLineWidth: 3.6,
|
|
649
|
-
StubTieLength: 5,
|
|
650
|
-
StaffHeight: 8,
|
|
651
|
-
TabHeight: 20
|
|
1035
|
+
for (const key in colors) Object.freeze(colors[key]);
|
|
1036
|
+
var color_name_default = Object.freeze(colors);
|
|
1037
|
+
|
|
1038
|
+
// node_modules/color-name-to-code/dist/color-names.js
|
|
1039
|
+
var colorNames = color_name_default;
|
|
1040
|
+
|
|
1041
|
+
// node_modules/color-name-to-code/dist/color-array-to-hex.js
|
|
1042
|
+
var colorArrayToHexDefaultOptions = {
|
|
1043
|
+
hash: true,
|
|
1044
|
+
lowercase: false,
|
|
1045
|
+
short: false
|
|
652
1046
|
};
|
|
1047
|
+
function colorArrayToHex(arr, partialOptions) {
|
|
1048
|
+
const options = __spreadValues(__spreadValues({}, colorArrayToHexDefaultOptions), partialOptions);
|
|
1049
|
+
const { hash, lowercase, short } = options;
|
|
1050
|
+
let hex = arr.map((num) => {
|
|
1051
|
+
let str = num.toString(16);
|
|
1052
|
+
str = str.length === 1 ? `0${str}` : str;
|
|
1053
|
+
return str;
|
|
1054
|
+
}).join("");
|
|
1055
|
+
if (short) {
|
|
1056
|
+
const chars = [...hex];
|
|
1057
|
+
if (chars[0] === chars[1] && chars[2] === chars[3] && chars[4] === chars[5]) {
|
|
1058
|
+
hex = `${chars[0]}${chars[2]}${chars[4]}`;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
hex = lowercase ? hex.toLowerCase() : hex.toUpperCase();
|
|
1062
|
+
if (hash) {
|
|
1063
|
+
hex = `#${hex}`;
|
|
1064
|
+
}
|
|
1065
|
+
return hex;
|
|
1066
|
+
}
|
|
653
1067
|
|
|
654
|
-
//
|
|
655
|
-
|
|
1068
|
+
// node_modules/color-name-to-code/dist/color-array-to-rgb.js
|
|
1069
|
+
function colorArrayToRGB(arr, alpha = 1) {
|
|
1070
|
+
alpha = Math.min(1, Math.max(0, alpha));
|
|
1071
|
+
if (alpha < 1) {
|
|
1072
|
+
return `rgba(${arr[0]}, ${arr[1]}, ${arr[2]}, ${alpha})`;
|
|
1073
|
+
}
|
|
1074
|
+
return `rgb(${arr[0]}, ${arr[1]}, ${arr[2]})`;
|
|
1075
|
+
}
|
|
656
1076
|
|
|
657
|
-
//
|
|
658
|
-
var
|
|
1077
|
+
// node_modules/color-name-to-code/dist/color-name-to-code.js
|
|
1078
|
+
var colorNameToCodeDefaultOptions = __spreadProps(__spreadValues({}, colorArrayToHexDefaultOptions), {
|
|
1079
|
+
fallback: true,
|
|
1080
|
+
alpha: 1,
|
|
1081
|
+
format: ColorCodeFormat.Hex
|
|
1082
|
+
});
|
|
1083
|
+
function colorNameToCode(value, partialOptions = {}) {
|
|
1084
|
+
const options = __spreadValues(__spreadValues({}, colorNameToCodeDefaultOptions), partialOptions);
|
|
1085
|
+
const { fallback, format, hash, lowercase, short, alpha } = options;
|
|
1086
|
+
value = `${value}`;
|
|
1087
|
+
const colorName = value.toLowerCase().replaceAll(/[^a-z]/g, "");
|
|
1088
|
+
let colorArray = colorNames[colorName];
|
|
1089
|
+
if (!colorArray) {
|
|
1090
|
+
if (!fallback) {
|
|
1091
|
+
throw new Error(`no matching color found for '${value}'`);
|
|
1092
|
+
}
|
|
1093
|
+
const hex = value.toLowerCase().replaceAll(/[^\da-f]/g, "");
|
|
1094
|
+
colorArray = (hex.length <= 3 ? [hex.slice(0, 1).repeat(2), hex.slice(1, 2).repeat(2), hex.slice(2, 3).repeat(2)] : [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)]).map((str) => Number.parseInt(str.length < 2 ? `${"0".repeat(2 - str.length)}${str}` : str, 16));
|
|
1095
|
+
}
|
|
1096
|
+
switch (format) {
|
|
1097
|
+
case ColorCodeFormat.Array: {
|
|
1098
|
+
return [...colorArray];
|
|
1099
|
+
}
|
|
1100
|
+
case ColorCodeFormat.RGB: {
|
|
1101
|
+
return colorArrayToRGB(colorArray, alpha);
|
|
1102
|
+
}
|
|
1103
|
+
default: {
|
|
1104
|
+
return colorArrayToHex(colorArray, { hash, lowercase, short });
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
659
1108
|
|
|
660
1109
|
// src/score/engine/assets/G-clef.png
|
|
661
1110
|
var G_clef_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAACWCAYAAACCe+v6AAADHXpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHja7ZZRcu0mDIbfWUWXgCSExHIwmJnu4C6/Pxg7J2kyTdv7GJhjsJCF0CfZJ5y//hzhDzRK5iGpeS45R7RUUuGKicerHetKMa3ratL2Gr2Xh5L3AkMkU/O6LbzlJ+SY074vexO69W9D94QqZvq2UOuWH+/lxzbI/tHQ9kDo2jn2/cA2JLw9Std92x7l4vbuaH2fGYqXyN9+SYyzZrKEa+JolgvmzjEZ4tmno6NxWYb0CugjuO9vVYZPfApJxFUkXV7K/IlUjBlXrAYokhhuFMK5UFbgI1DCBXha9kY1PsF8jc1bjL5o3zlWxCbjnMov1J7xQ97k/HnePLOdBg81z3tB3mON+Rk/lZPehu4Fefbh1529PTu/k4vE9BqK8Ip7jO5jHRqnqCkjFnkf6j7KmkHvmFFcT2V0izkgax2T2Qu6xxobcqrHhko7MC/EoDsoUadKg841NmpwMfHJhpG5BZYldEAq3GQmQ5qdBpsU6eLImHblkPDjC61ty9qukcceYieoMsEY4ZH/3MN3FceYtUQU/YoT0gJ+8axOeBEJ+OcANTCgsYOqK8B3/9gm18lMV5gdB6zxCJeJQ+ktuWSBFigqxgsyWd8GECJsrXCGBARiJlHK8MiYjQiBdACqcJ0l8QECpModTnISyYCD6sDeeMZoqbLyJcZbVVJAsWYUrYNQBayUFPljyZFDVUWTqmY1dS1as+RZeTlbnq/namLJ1LIZ3tlWrLp4cvXs5u7Fa+EieH1rQZ0WL6XUik0rLFc8XaFQ68GHHOnQIx92+FHCURvSp6WmLTdr3kqrnbt0FHjP3br30utJJ1LpTKee+bTTz3LWgVQbMtLQkYeF4aOM+lCjXbYf+7+gRpsaL1JT0R5qkJrdJmi+TnQyAzFOBOAGaiCGxJ7MolNKPMlNZvgeoSqU4aROOJ0mMRBMJ7EOethtcoHr7+EWzBc3/r/kwkT3TXJ/5/YZtT6/Em0Ru8pwBjUKqg/rp1f2Oj+vX47hnxS+O/4Y+jH0Y+jrcYwROv51hb8AKbCqdGIdCl0AAAGFaUNDUElDQyBwcm9maWxlAAB4nH2RPUjDQBzFX1O1UqoOdhBxyFCd7OAH0rFUsQgWSluhVQeTS7+gSUOS4uIouBYc/FisOrg46+rgKgiCHyCuLk6KLlLi/5JCi1gPjvvx7t7j7h0gNCpMNXuigKpZRioeE7O5VdH3ij74MYgpRCRm6on0YgZdx9c9PHy9C/Os7uf+HANK3mSARySOMt2wiDeI5zYtnfM+cZCVJIX4nHjSoAsSP3JddvmNc9FhgWcGjUxqnjhILBY7WO5gVjJU4lnikKJqlC9kXVY4b3FWKzXWuid/YSCvraS5TnMMcSwhgSREyKihjAoshGnVSDGRov1YF/+o40+SSyZXGYwcC6hCheT4wf/gd7dmYWbaTQrEgN4X2/4YB3y7QLNu29/Htt08AbzPwJXW9lcbQOST9HpbCx0BQ9vAxXVbk/eAyx1g5EmXDMmRvDSFQgF4P6NvygHDt4B/ze2ttY/TByBDXS3fAAeHwESRste7vLu/s7d/z7T6+wEMNXLkxtwRywAADzRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+Cjx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDQuNC4wLUV4aXYyIj4KIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgIHhtbG5zOkdJTVA9Imh0dHA6Ly93d3cuZ2ltcC5vcmcveG1wLyIKICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIgogICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICB4bXBNTTpEb2N1bWVudElEPSJnaW1wOmRvY2lkOmdpbXA6NDA3ODVjMzYtNDAxZC00YTZlLTkxODctMDQ1NTI4MmM0ZGY2IgogICB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhiZTJkYzc1LTVlYjQtNDk0Yy1iNWRlLWQ2MzZkNzZhNjI2YiIKICAgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOmU3YWE0MWNhLTNiYjMtNGU5Yi05NDQxLTllNTNmZTJiZjM5ZiIKICAgZGM6Rm9ybWF0PSJpbWFnZS9wbmciCiAgIEdJTVA6QVBJPSIyLjAiCiAgIEdJTVA6UGxhdGZvcm09IldpbmRvd3MiCiAgIEdJTVA6VGltZVN0YW1wPSIxNjg2NDA4NjA5MzE2NDM4IgogICBHSU1QOlZlcnNpb249IjIuMTAuMzQiCiAgIHRpZmY6T3JpZW50YXRpb249IjEiCiAgIHhtcDpDcmVhdG9yVG9vbD0iR0lNUCAyLjEwIgogICB4bXA6TWV0YWRhdGFEYXRlPSIyMDIzOjA2OjEwVDE3OjUwOjA5KzAzOjAwIgogICB4bXA6TW9kaWZ5RGF0ZT0iMjAyMzowNjoxMFQxNzo1MDowOSswMzowMCI+CiAgIDx4bXBNTTpIaXN0b3J5PgogICAgPHJkZjpTZXE+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InNhdmVkIgogICAgICBzdEV2dDpjaGFuZ2VkPSIvIgogICAgICBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjI3MzY2YmY0LWVkZDMtNDE5OC05NjJhLWU5ZTM5MTBlNThiZSIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iR2ltcCAyLjEwIChXaW5kb3dzKSIKICAgICAgc3RFdnQ6d2hlbj0iMjAyMi0wOC0yMlQwMjo1NTozNiIvPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJzYXZlZCIKICAgICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo5NjVlMTM3OS0wZDlmLTQ5ODItYWQ3MC05MzhjOWMzOWE0ZjMiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoV2luZG93cykiCiAgICAgIHN0RXZ0OndoZW49IjIwMjItMDktMTFUMTY6MzU6MDAiLz4KICAgICA8cmRmOmxpCiAgICAgIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiCiAgICAgIHN0RXZ0OmNoYW5nZWQ9Ii8iCiAgICAgIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MTBmYmEwYTMtOTI5Yi00NTRlLThjNGMtOGVkOGM4YWJhZGRjIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJHaW1wIDIuMTAgKFdpbmRvd3MpIgogICAgICBzdEV2dDp3aGVuPSIyMDIzLTA2LTEwVDE3OjUwOjA5Ii8+CiAgICA8L3JkZjpTZXE+CiAgIDwveG1wTU06SGlzdG9yeT4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/Ppn4NIQAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfnBgoOMgm5WlWBAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAACHtJREFUeNrtnXuQVmMcxz+77cauTWUpbGSVu2w3BpnUEBq3chkmBjGayG1GBuNWLtUgw5SJkBkjl4QKg1wyQyarK0lRSlstU20bWam9+OM8O3P6vc8553nOe97tnO18Z84f57zP7XvOc/ndnueFfQx5e6neUmAI0B3oDPwD/AJ8Dvzcml5we+Al4D+gyeOaB1S0BrLHAut9iLqvf4ERSSZbBmwwJOu+RieV8JwQZJuARjXWE4WBIck2X38AByaJ8MwsCTcBTyWFbCFQFwHhv4DiKBqUn2PCPYEin9+bgI3AUuBPn3TtgMuT8IWv8vlq7wLdRPrTgPke6d9JAuFbPBo/3UfKK1TCh8yzIQmEb/cYjx0C8pUDuzV5D477GN6mefY+UBuQby0wV/O8U9wJr9E8W2iY92vNs45xJ6zTfKoN827UPNsdd8K1SlJyo8Awb7XhEIkVYYAVmjXVBPtr1uyqJBBeLu5LDPMdppkPdiaRcHvDfKeJ+++SIFoCLBP3R1toWW58lhQFogiodwkPlYZf1y1w/AcclCQVcYWQtILwqiA8M2lGgDcFgSN90nbXiJUXRdWQ/BYiLMdxH5+0k8VavRb4JGmEl4j7vh7pRgDni2fj1RyQKBwiuqjui/Un015dBbQloXCbaTdrZuUajTp4IwnGbEHmKPX8QmCHhuwC9p4rKBI8IghdB0zCsT1Lsg0+4zwxuEiQqqcVmGWDlAETk+zSJE9Ublyjuqof2TrgxKQT7anMNSZfd1iSiZYCUwy+avP1dJLJXglsxdyV8hHQJolEDwBewc5v9J3Klzj0xYnTsCG7W4mdicMdwC7CeQaPTBLRAjUxZeMKvSwpZPcDPghBUGpE45JAthjH92NLdiUwSDz7NO5k24YkuwTHGZYvtKMtcSabD7wVguy37OkilU7v8rgSfjoE2c816+wkkebKOJK9NgTZ2Wpykxgu0k2IG9lTcMIBbchOx9tTWKHpBbFBoZpwbMi+iL9FtEC8wG1xIvyQJdlJhuVWinzd4kD2cJxYZlOyky3KfkHkvSoOhF+2IPu8Zdk3x82O1QV96JDumhJSu5KB4XsVEwzJziCcy2Z/8UK3K5G1PZnhDi2iBW02IDvPY501xY8BuvJ6JcY+AQzAPCDGGucZkF2GefiCxFk4AWoN2K0AG4HHiSBATWJqQMXr1Qxui3Jlv8o2nHiHIl4UFeF1+G/ACOMGuZVoYqfd12qgX7ZkuwZUMjyEoWBaxETd1y5gVDaEr/YpfGqIyW9ODsm6r7FhCY/z6T625tTpLUS2+bo3DOHZHoVdYFnOqBYmG3rbz1JNQbZ2p2MsZfAor604G8OMsUVTyEBLwjMsv4r7vkapl28AH+PEWNqu1++ZNjRPk3mFJdnjDBu4HBipVoUGsewVaGb6fjgRPSsMSQ8wNb/KjA9bEp5osIzcLUitEml6BNQxxGPoWVtROmoynmFJ+CefRvytxFaJt0W6GwwtqE8GkA56cZSSGVxiI74FhTUM9ch3f0irCerleNU3wbZL2xrJzwhp+hks0s6PaBitMsnsXk7WWlY8xKPi7fjvOZI94x/sHOQFPobGw+U4kHBvrrDVRrw2RE4L6C3V7Ln3sBg43qLeeuAxj996BxHeJCYxm2i4Gh8RMwjL/BpqgA/VpKgTgnwJuzdXtbWUWpZpntUCiwwlPDf6WBLeBSzWPO8URFjuHOthUWm1ptJFaizZErb9wvJjNaMkiLDck2CrYD8n7k13hUrCvUIYB3Vdui6I8FI1qzbjUstKXwe+EV3aBKtE40pwjsKwwQEeuoEv4d3ALNf9ycCpFpU24ngRVrvkYNN8y7Ps1rqlb3MQYXCc3m7YytOb1FCYa2lhzHbiqjAoU4s2GoG+D+Fg85VGijq/ssh7qEboqLGZB6QDvBLHdZpLnK6R0EzlgNs0hGfZVJ6v1lV3ARNzTLhYo0sfY5h3sYWy4ole7Blh16ismrnEStFok/ou05BdR8iA1QfJDN2/PoeEZZTQkwZL0RoN4bvCNiCPzONlGpVJNBe7Tu4TdX1h2bbmmLCCbMfWAvTew6iDQy/QzLReZJ/RtKk+pFiagXZqmdCdyzGG8J5Eic6aOuSe4yK8A+RGRfn2/SqqwdmbVBZBPX/gHbh2MfAbEbtbTAQEr7itehyX6DDCn6zyCZlhUHcoTc7Ltj2WHKNcLexBRvaFaqxdr0Q/k2OixmNudN9uo+BEMcsOAB4AzrXIU6vUxlrVU3YqJaMEOELZoUzW0PeBezz04JyjN07o0mZy7zD7EjiTmKAQOAfHJlyJ/xmWtsHlo1UPCI28FnoBJym9urtaYspwdrOUKkmprerC/6pl7lel/HdxlTORBB/7aIJnLSQuK40orlisUWRaNXpoxnHX1ky4DZlhTkNbc5duwAlNjLRb58f8Ky/e1wgv2dcmrr6aiSur3agFOWxsL6XM91a6crUSCWfi+H9NoDtEsIKY7YI52sNQ4D5uZpBFeTKMamScyJqeFL4L8yOjfhB5x8Rp0ppoaPEoBF4j86A/HerEfUlcCB8GXGGRvqPSZYPQIeAF7DXC/bE3fJsY2eWsvCEuhMtC9oouAROgPPxveVwIN4TM53f08tnifgfmh/nmnPC6kPk2+fx2k7ifpWb4WKAT9mG+foFvMqqvkRj+pYntFp0HPMrZj8wg1VieEd8Tc6NdFXr3TCFOgLc77TZifE7AaAOyv+MY9iS64pxBK7vyJXHWcLy8eu4T0dybo9vhBMBMJvMwwEbgzqSodnfhvxOtDieQzOv3ncRkE7UNytV4tJ295+LsnUgsugKPAt/jvQm7DmcX2+Bcj7eWRjFwAo4rtYOa1avUMrSTFClSpEiRIkWKFClSpEiRIkWKFClSpEiRIkWKFClSpEiRIgL8D6ed2EKeJMaTAAAAAElFTkSuQmCC";
|
|
662
1111
|
|
|
1112
|
+
// src/score/engine/assets/F-clef.png
|
|
1113
|
+
var F_clef_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAABGCAYAAACQRffVAAADInpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHja7VdbktwgDPznFDkCkgCJ4/AwVblBjp8GY+/OZFPZPD7yMVADWIiWUEt2jTu+fR3uCxplTi5EtZRT8mghh8wFC/Nnq2skH9a4mrS9R49yF9LeYIhkap6Pmbf8gBxr2s95G6FL/wK6FlSwim8bpWx5fZTXDcj2DLQ3hE7Lvu8DG0h4exTO57Y9Stn04Wp93xmKp8jefkGUU0ykAWNgr5oy1sY+KOLZp6PcznP31S7B9XypMnziQ0g8RpFweinzJ1IwJ4wk4qA4hUXiGlmWGTiUEG4Fbj6BR/F3MN/H5i1GP2mfuZaHkXFM5XdXu+envOn147y5VzsN3JU3lvaGPNLq0z1/KKd4AV0bctvh95at3ZYf5ENWdt3Nvad7jG5jXRq3KCEhFmlf6rrKWkGvziiuUwldfXLANSxmz+jmi2/Iqe4bKq1inYnB/aBAnQoNOtbcqMHFwAcrZubmWJbQQFLmhlQgCbPTYJUsXQwp0c4cEr59oWU2L3ONzHfnO0GVCWCEI3/c3WcVx5i1ROTtjBM8g188qxNeeAL9c4IaGKGxgxpXgK/+3CavAgbjCrPhgsVXd0LUSG/JJYvoSW/EfFY9ad8ACBFMRzhDAgZ8IomU4JEyKxECaSCowHWWwBUMUIzc4SQHkQRyUB2wjTNKS5Ujn2K8VSU4FGsSBTdZCsgKISJ/NBhyqESJIcaYokaLOZYkaVZeSprm67moaNCoSVXNadZiYsGiJVMzy1YyZ8HrO2bUabaccykwWoBccLpAoZTKVWqosaaq1Wp2tTSkTwstttS0WcutdO7SUeA9de3Wcy8HHUilIxzxSIceduSjDKTakBFGHGmoGzbyKDdrtMv2uf8Ga7RZ48XUVNSbNUhVLwiar5M4OQNjHAiEK1gDY0jsyZk3CoEnc5MzfI9QFZHhZJzkdJqMgcFwEMdBN3ebOcfl3/Dm1BZv/LfMuUndJ5n7kbePWOvzK9EWY2cZzqB6QfVh/7DCVubn9aez+5XCZ+cX0AvoBfQCegG9gP57oIEPJ/4Bue+bLIaQwqExNwAAAYVpQ0NQSUNDIHByb2ZpbGUAAHicfZE9SMNAHMVfU7UiFQeLijhkqE4WREUcSxWLYKG0FVp1MLn0Q2jSkKS4OAquBQc/FqsOLs66OrgKguAHiKuLk6KLlPi/pNAixoPjfry797h7Bwj1MlPNjiigapaRisfEbG5FDLyiC0EMYgIDEjP1RHohA8/xdQ8fX+8iPMv73J+jV8mbDPCJxFGmGxbxOvHMpqVz3icOsZKkEJ8Tjxt0QeJHrssuv3EuOizwzJCRSc0Rh4jFYhvLbcxKhko8TRxWVI3yhazLCuctzmq5ypr35C8M5rXlNNdpjiCORSSQhAgZVWygDAsRWjVSTKRoP+bhH3b8SXLJ5NoAI8c8KlAhOX7wP/jdrVmYmnSTgjGg88W2P0aBwC7QqNn297FtN04A/zNwpbX8lTow+0l6raWFj4C+beDiuqXJe8DlDjD0pEuG5Eh+mkKhALyf0TflgP5boGfV7a25j9MHIENdLd0AB4fAWJGy1zze3d3e279nmv39ANCccsygwwDVAAAQE2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNC40LjAtRXhpdjIiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iCiAgICB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIgogICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICAgeG1sbnM6R0lNUD0iaHR0cDovL3d3dy5naW1wLm9yZy94bXAvIgogICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgIHhtcE1NOkRvY3VtZW50SUQ9ImdpbXA6ZG9jaWQ6Z2ltcDo0MDc4NWMzNi00MDFkLTRhNmUtOTE4Ny0wNDU1MjgyYzRkZjYiCiAgIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Nzg3YjYxN2YtMjg1MS00YzhlLTg2MTYtZWM3NGMwYzYwMWVlIgogICB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6ZTdhYTQxY2EtM2JiMy00ZTliLTk0NDEtOWU1M2ZlMmJmMzlmIgogICBkYzpGb3JtYXQ9ImltYWdlL3BuZyIKICAgR0lNUDpBUEk9IjIuMCIKICAgR0lNUDpQbGF0Zm9ybT0iV2luZG93cyIKICAgR0lNUDpUaW1lU3RhbXA9IjE2ODY2MTM5NDcxOTU2ODAiCiAgIEdJTVA6VmVyc2lvbj0iMi4xMC4zNCIKICAgdGlmZjpPcmllbnRhdGlvbj0iMSIKICAgeG1wOkNyZWF0b3JUb29sPSJHSU1QIDIuMTAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjM6MDY6MTNUMDI6NTI6MjUrMDM6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIzOjA2OjEzVDAyOjUyOjI1KzAzOjAwIj4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiCiAgICAgIHN0RXZ0OmNoYW5nZWQ9Ii8iCiAgICAgIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MjczNjZiZjQtZWRkMy00MTk4LTk2MmEtZTllMzkxMGU1OGJlIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJHaW1wIDIuMTAgKFdpbmRvd3MpIgogICAgICBzdEV2dDp3aGVuPSIyMDIyLTA4LTIyVDAyOjU1OjM2Ii8+CiAgICAgPHJkZjpsaQogICAgICBzdEV2dDphY3Rpb249InNhdmVkIgogICAgICBzdEV2dDpjaGFuZ2VkPSIvIgogICAgICBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjk2NWUxMzc5LTBkOWYtNDk4Mi1hZDcwLTkzOGM5YzM5YTRmMyIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iR2ltcCAyLjEwIChXaW5kb3dzKSIKICAgICAgc3RFdnQ6d2hlbj0iMjAyMi0wOS0xMVQxNjozNTowMCIvPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJzYXZlZCIKICAgICAgc3RFdnQ6Y2hhbmdlZD0iLyIKICAgICAgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDoxMGZiYTBhMy05MjliLTQ1NGUtOGM0Yy04ZWQ4YzhhYmFkZGMiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkdpbXAgMi4xMCAoV2luZG93cykiCiAgICAgIHN0RXZ0OndoZW49IjIwMjMtMDYtMTBUMTc6NTA6MDkiLz4KICAgICA8cmRmOmxpCiAgICAgIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiCiAgICAgIHN0RXZ0OmNoYW5nZWQ9Ii8iCiAgICAgIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDBmYjM4YTMtZjZiMi00NjQ1LTliMTYtMjlhNWE0ODZlMjhhIgogICAgICBzdEV2dDpzb2Z0d2FyZUFnZW50PSJHaW1wIDIuMTAgKFdpbmRvd3MpIgogICAgICBzdEV2dDp3aGVuPSIyMDIzLTA2LTEzVDAyOjUyOjI3Ii8+CiAgICA8L3JkZjpTZXE+CiAgIDwveG1wTU06SGlzdG9yeT4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PsIRrtIAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfnBgwXNBsqJURsAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAABF9JREFUeNrtmluIF1Ucxz9/E8P1VnnJ9dJWC4Frmq2JJmqolGEILoQvK2gZeXlRCSm1Fx9UEsJQERWsXhRftECs0Gq70EK9ZHlbFyHbds3VVXFX91+7664P81tYhpnfmft//st84TzMzDm/8/vOnPO7nYEMGTJkyJAhQ4YMGSJBLkJZw4FyYAIwDHgU+A9oAxqBv4C7xfyySoBlwKfAFaAb6DG0euAzoAoYXCxEnwH2A60eCGrtFrALGJNWokNEwY6QRO2tFXgPGJAmss8DlyImam/fASPTQHaeGJueBFod8FQhrfSLwM+ynDX8L1/oV+BP4LZY58eBUUAlMB94ycPSvQTMERmJ4jGgwYPh2Qg84VFmGbAP6DTI/aoQS/lzg1JfA2MDyn4ZuGaQvyZJspUGv3oKGBhyjmeBJmWOmxLMJIITiiIXIgwaZgFdylxbDeNHANXAZmAVUBpEiScNe2xRxC/3Y2WuRmUlLRHD1rd/HljvV4F3FAVqYlhNo4B7Pl/wdPEMbmOq/ShwRBH0Vkxb6LAy536fW64HuOpn8vOKoLKYCC9Q5rzs0L/JQxDjyYPkgHYXAW0xGslByrLuFuPUFw0eCI92mmiAQ4LgZoEbYyTcAZxVPsJk271ag7x6cWueCLvhfsyu8LzybKLtersUF9ywxe2BnXBnAZOUJuXZeNv1OSki3LLdzwPrgONuguw+7g7wAHjEoW+vEagAXgeelr1yUSZoCUn4hvJsqMO9byRaWyLGtFkiwOtBJnYzBKcVg/ZuSMIrlHl3RrWMnFK1OqX/q8oXOAisDqFLVxL7xonw9yHk7Q5RoxpuyLdjI3wmhLzBwMqAY0ck4SGcCNeKIQqKOTF84RtxEu4BPgohc2QM467HSRjgqBL5mBDUPU1Rnl1JwqBNUuJqrW0M+OLdYuk8Cdas38Rf4b3FR0HP/nLdZNYaioKbxSVuA6ZGQfoNvNWlO6VvEKxW5O5yGbNc4ml7ZrUtCtLjgGMSdjop9Q+wMIT8GoXwKw79ZxrKUG9r+a8flMoyr5AA4ybwo1QgggYHpZJ6Ou3Ta5IpddvufwEsVWQ2xFisCI1Nypf6RMmsIql4JI0S8bFuSs9UvmCgikeh8b6i8C/KuKOYD+VShzGSwLsprRnByYYYoSqNhE8qCv/kYfxrYjT7jmuPIC+PBWsVsl1YRzBeE45qqWGtwjo1SR0WoZ8a7KAfYa5h7/2OVaPuF1gqtS83srclpi565IAP0c+b7wOz+wPZckOc3Jt0LC52oiXABx7y6VasGnfRYgiwwRAu9raGqPLXQmAGcADvvyN+m9bgXnP4i4E9wN8+KiJ5WQG5QilumnioJP9lwHPANKw/fF7A+fxJw2ms/y9SFdiPBf4Vn9hJNL8T/iFxbyoxgej+m6zBOtnLpXlvhiXcDOyVJV8UCEL4KnBI/OnAtBP0q+ADMTq/SfshrdUFr4TzwJdY9d57WIdYzRIk1GMdeXSQIUOGDBmSwUMtd8u2ArdcUAAAAABJRU5ErkJggg==";
|
|
1114
|
+
|
|
663
1115
|
// src/score/engine/render-context.ts
|
|
664
|
-
var
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
var ImageAssets = new UniMap([
|
|
668
|
-
[0 /* G_Clef */, { src: G_clef_default }],
|
|
669
|
-
[1 /* F_Clef */, { src: F_clef_default }]
|
|
1116
|
+
var ImageData = new UniMap([
|
|
1117
|
+
[0 /* G_Clef */, G_clef_default],
|
|
1118
|
+
[1 /* F_Clef */, F_clef_default]
|
|
670
1119
|
]);
|
|
1120
|
+
var getImageData = (asset) => ImageData.getOrDefault(asset, "");
|
|
1121
|
+
var ImageCache = new BiMap();
|
|
1122
|
+
function colorNameToRGBA(name, alpha = 1) {
|
|
1123
|
+
const hex = colorNameToCode(name).replace("#", "");
|
|
1124
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
1125
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
1126
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
1127
|
+
const a = Math.round(alpha * 255);
|
|
1128
|
+
return [r, g, b, a];
|
|
1129
|
+
}
|
|
671
1130
|
function staffPosEquals(a, b) {
|
|
672
1131
|
if (!a && !b) return true;
|
|
673
1132
|
else if (!a || !b) return false;
|
|
@@ -702,23 +1161,9 @@ var RenderContext = class {
|
|
|
702
1161
|
__publicField(this, "onMouseLeaveFn");
|
|
703
1162
|
__publicField(this, "onTouchEndFn");
|
|
704
1163
|
this.devicePixelRatio = window.devicePixelRatio;
|
|
705
|
-
this.fontSize =
|
|
1164
|
+
this.fontSize = device_exports.FontSize * DocumentSettings.DocumentScale * this.devicePixelRatio;
|
|
706
1165
|
this.unitSize = this.fontSize * 0.3;
|
|
707
1166
|
this._lineWidth = this.unitSize * 0.2;
|
|
708
|
-
ImageAssets.forEach((asset) => {
|
|
709
|
-
if (asset.finished !== true) {
|
|
710
|
-
const img = new Image();
|
|
711
|
-
img.src = asset.src;
|
|
712
|
-
img.onload = () => {
|
|
713
|
-
asset.img = img;
|
|
714
|
-
this.finishImageAsset(asset);
|
|
715
|
-
};
|
|
716
|
-
img.onerror = () => {
|
|
717
|
-
this.finishImageAsset(asset);
|
|
718
|
-
throw new MusicError2(MusicErrorType2.Score, "Failed to load image: " + asset.src);
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
1167
|
this.onClickFn = this.onClick.bind(this);
|
|
723
1168
|
this.onMouseMoveFn = this.onMouseMove.bind(this);
|
|
724
1169
|
this.onMouseLeaveFn = this.onMouseLeave.bind(this);
|
|
@@ -731,16 +1176,66 @@ var RenderContext = class {
|
|
|
731
1176
|
var _a;
|
|
732
1177
|
return (_a = this.mdoc) == null ? void 0 : _a.getMusicObject();
|
|
733
1178
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
1179
|
+
getImageAsset(asset, color) {
|
|
1180
|
+
var _a;
|
|
1181
|
+
color != null ? color : color = "";
|
|
1182
|
+
return (_a = ImageCache.getOrCreate(asset, color, () => {
|
|
1183
|
+
const a = { src: getImageData(asset), color, loaded: false, colorized: false };
|
|
1184
|
+
const img = new Image();
|
|
1185
|
+
img.src = a.src;
|
|
1186
|
+
img.onload = () => {
|
|
1187
|
+
a.img = img;
|
|
1188
|
+
this.onImageLoaded(a);
|
|
1189
|
+
};
|
|
1190
|
+
img.onerror = () => {
|
|
1191
|
+
console.error("Failed to load image: " + a.src);
|
|
1192
|
+
};
|
|
1193
|
+
return a;
|
|
1194
|
+
})) == null ? void 0 : _a.img;
|
|
740
1195
|
}
|
|
741
|
-
|
|
1196
|
+
forceDraw() {
|
|
742
1197
|
var _a;
|
|
743
|
-
|
|
1198
|
+
(_a = this.doc) == null ? void 0 : _a.requestFullLayout();
|
|
1199
|
+
this.draw();
|
|
1200
|
+
}
|
|
1201
|
+
onImageLoaded(data) {
|
|
1202
|
+
if (data.loaded || !data.img) return;
|
|
1203
|
+
if (data.colorized || data.color === "") {
|
|
1204
|
+
this.forceDraw();
|
|
1205
|
+
data.loaded = true;
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
const [nr, ng, nb, na] = colorNameToRGBA(data.color);
|
|
1209
|
+
const threshold = 40;
|
|
1210
|
+
const canvas = document.createElement("canvas");
|
|
1211
|
+
canvas.width = data.img.width;
|
|
1212
|
+
canvas.height = data.img.height;
|
|
1213
|
+
const ctx = canvas.getContext("2d");
|
|
1214
|
+
if (ctx == null) {
|
|
1215
|
+
console.error("Failed to colorize image: ctx = null.");
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
ctx.drawImage(data.img, 0, 0);
|
|
1219
|
+
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
1220
|
+
const d = imageData.data;
|
|
1221
|
+
for (let i = 0; i < d.length; i += 4) {
|
|
1222
|
+
const r = d[i], g = d[i + 1], b = d[i + 2], a = d[i + 3];
|
|
1223
|
+
if (a === 0) continue;
|
|
1224
|
+
if (r < threshold && g < threshold && b < threshold) {
|
|
1225
|
+
d[i + 0] = nr;
|
|
1226
|
+
d[i + 1] = ng;
|
|
1227
|
+
d[i + 2] = nb;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
ctx.putImageData(imageData, 0, 0);
|
|
1231
|
+
data.img.src = canvas.toDataURL("image/png");
|
|
1232
|
+
data.img.onload = () => {
|
|
1233
|
+
data.colorized = true;
|
|
1234
|
+
this.onImageLoaded(data);
|
|
1235
|
+
};
|
|
1236
|
+
data.img.onerror = () => {
|
|
1237
|
+
console.error("Failed to colorize image.");
|
|
1238
|
+
};
|
|
744
1239
|
}
|
|
745
1240
|
setDocument(mdoc) {
|
|
746
1241
|
if (this.mdoc === mdoc) {
|
|
@@ -860,12 +1355,6 @@ var RenderContext = class {
|
|
|
860
1355
|
onTouchEnd(e) {
|
|
861
1356
|
this.usingTouch = true;
|
|
862
1357
|
}
|
|
863
|
-
onLoad() {
|
|
864
|
-
if (this.doc) {
|
|
865
|
-
this.doc.requestFullLayout();
|
|
866
|
-
this.draw();
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
1358
|
hilightObject(obj) {
|
|
870
1359
|
this.hilightedObj = obj;
|
|
871
1360
|
}
|
|
@@ -914,7 +1403,7 @@ var RenderContext = class {
|
|
|
914
1403
|
if (!staff) {
|
|
915
1404
|
return;
|
|
916
1405
|
}
|
|
917
|
-
this.fillColor(
|
|
1406
|
+
this.fillColor(DocumentColor.HilightStaffPos);
|
|
918
1407
|
this.fillRect(staff.row.getRect().left, staff.getDiatonicIdY(diatonicId) - unitSize, staff.row.getRect().width, 2 * unitSize);
|
|
919
1408
|
if (mousePos !== void 0) {
|
|
920
1409
|
this.drawLedgerLines(staff, diatonicId, mousePos.x);
|
|
@@ -926,13 +1415,13 @@ var RenderContext = class {
|
|
|
926
1415
|
return;
|
|
927
1416
|
}
|
|
928
1417
|
let rect = hilightedObj.getRect();
|
|
929
|
-
this.lineColor(
|
|
1418
|
+
this.lineColor(DocumentColor.HilightObject);
|
|
930
1419
|
this.strokeRect(rect.left, rect.top, rect.width, rect.height);
|
|
931
1420
|
}
|
|
932
1421
|
drawPlayCursor() {
|
|
933
1422
|
let { cursorRect: r } = this;
|
|
934
1423
|
if (r) {
|
|
935
|
-
this.color(
|
|
1424
|
+
this.color(DocumentColor.PlayCursor).lineWidth(2).strokeLine(r.centerX, r.top, r.centerX, r.bottom);
|
|
936
1425
|
}
|
|
937
1426
|
}
|
|
938
1427
|
txFromScreenCoord(screenCoord) {
|
|
@@ -942,8 +1431,10 @@ var RenderContext = class {
|
|
|
942
1431
|
return coord.div(this.devicePixelRatio);
|
|
943
1432
|
}
|
|
944
1433
|
clearCanvas() {
|
|
945
|
-
|
|
946
|
-
|
|
1434
|
+
if (this.ctx) {
|
|
1435
|
+
this.ctx.canvas.style.background = DocumentColor.Background;
|
|
1436
|
+
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
|
|
1437
|
+
}
|
|
947
1438
|
}
|
|
948
1439
|
drawDebugRect(r) {
|
|
949
1440
|
if (DebugSettings.DrawDebugRects) {
|
|
@@ -998,7 +1489,7 @@ var RenderContext = class {
|
|
|
998
1489
|
toph = unitSize * (0.5 + flagCount - adj);
|
|
999
1490
|
bottomh = unitSize * (1 + flagCount + adj);
|
|
1000
1491
|
}
|
|
1001
|
-
return new
|
|
1492
|
+
return new AnchoredRect(-leftw, 0, rightw, -toph, 0, bottomh);
|
|
1002
1493
|
}
|
|
1003
1494
|
drawRest(restSize, x, y) {
|
|
1004
1495
|
let { unitSize } = this;
|
|
@@ -1184,7 +1675,7 @@ var RenderContext = class {
|
|
|
1184
1675
|
this.ctx.font = savedFont;
|
|
1185
1676
|
return metrics.width;
|
|
1186
1677
|
} else {
|
|
1187
|
-
return
|
|
1678
|
+
return utils_exports.Dom.getCanvasTextWidth(text, font);
|
|
1188
1679
|
}
|
|
1189
1680
|
}
|
|
1190
1681
|
arc(x, y, radius, startRadians, endRadians) {
|
|
@@ -1289,11 +1780,9 @@ var RenderContext = class {
|
|
|
1289
1780
|
};
|
|
1290
1781
|
|
|
1291
1782
|
// src/score/engine/obj-staff-and-tab.ts
|
|
1292
|
-
import { MusicError as
|
|
1293
|
-
import { AnchoredRect as AnchoredRect22, Guard as Guard9, UniMap as UniMap8, Utils as Utils10 } from "@tspro/ts-utils-lib";
|
|
1783
|
+
import { MusicError as MusicError13, MusicErrorType as MusicErrorType13 } from "@tspro/web-music-score/core";
|
|
1294
1784
|
|
|
1295
1785
|
// src/score/engine/obj-measure.ts
|
|
1296
|
-
import { Guard as Guard8, IndexArray as IndexArray2, UniMap as UniMap6, TriMap as TriMap2, ValueSet, Utils as Utils9, asMulti, AnchoredRect as AnchoredRect20 } from "@tspro/ts-utils-lib";
|
|
1297
1786
|
import { getScale, Scale, validateScaleType, Note as Note7, RhythmProps as RhythmProps5, KeySignature as KeySignature2, getDefaultKeySignature, PitchNotation, SymbolSet, validateNoteLength as validateNoteLength2, NoteLengthProps as NoteLengthProps5 } from "@tspro/web-music-score/theory";
|
|
1298
1787
|
import { getDefaultTempo, getDefaultTimeSignature } from "@tspro/web-music-score/theory";
|
|
1299
1788
|
|
|
@@ -1323,7 +1812,6 @@ var AccidentalState = class {
|
|
|
1323
1812
|
import { Note as Note2, getTempoString, KeySignature } from "@tspro/web-music-score/theory";
|
|
1324
1813
|
|
|
1325
1814
|
// src/score/engine/obj-image.ts
|
|
1326
|
-
import { AnchoredRect as AnchoredRect3 } from "@tspro/ts-utils-lib";
|
|
1327
1815
|
var ObjImage = class extends MusicObject {
|
|
1328
1816
|
constructor(parent, image, anchorX, anchorY, imageScale) {
|
|
1329
1817
|
super(parent);
|
|
@@ -1346,9 +1834,9 @@ var ObjImage = class extends MusicObject {
|
|
|
1346
1834
|
try {
|
|
1347
1835
|
let w = image.naturalWidth * imageScale * unitSize;
|
|
1348
1836
|
let h = image.naturalHeight * imageScale * unitSize;
|
|
1349
|
-
this.rect =
|
|
1837
|
+
this.rect = AnchoredRect.createSections(w * anchorX, w * (1 - anchorX), h * anchorY, h * (1 - anchorY));
|
|
1350
1838
|
} catch (err) {
|
|
1351
|
-
this.rect = new
|
|
1839
|
+
this.rect = new AnchoredRect();
|
|
1352
1840
|
}
|
|
1353
1841
|
}
|
|
1354
1842
|
offset(dx, dy) {
|
|
@@ -1362,8 +1850,7 @@ var ObjImage = class extends MusicObject {
|
|
|
1362
1850
|
};
|
|
1363
1851
|
|
|
1364
1852
|
// src/score/engine/obj-accidental.ts
|
|
1365
|
-
import { MusicError as
|
|
1366
|
-
import { AnchoredRect as AnchoredRect4 } from "@tspro/ts-utils-lib";
|
|
1853
|
+
import { MusicError as MusicError2, MusicErrorType as MusicErrorType2 } from "@tspro/web-music-score/core";
|
|
1367
1854
|
var ObjAccidental = class extends MusicObject {
|
|
1368
1855
|
constructor(parent, diatonicId, accidental, color = "black") {
|
|
1369
1856
|
super(parent);
|
|
@@ -1383,22 +1870,22 @@ var ObjAccidental = class extends MusicObject {
|
|
|
1383
1870
|
let { unitSize } = ctx;
|
|
1384
1871
|
switch (this.accidental) {
|
|
1385
1872
|
case -2:
|
|
1386
|
-
this.rect =
|
|
1873
|
+
this.rect = AnchoredRect.createSections(unitSize * 1.25, unitSize * 1.25, unitSize * 4, unitSize * 1.2);
|
|
1387
1874
|
break;
|
|
1388
1875
|
case -1:
|
|
1389
|
-
this.rect =
|
|
1876
|
+
this.rect = AnchoredRect.createSections(unitSize * 0.75, unitSize * 0.75, unitSize * 4, unitSize * 1.2);
|
|
1390
1877
|
break;
|
|
1391
1878
|
case 0:
|
|
1392
|
-
this.rect =
|
|
1879
|
+
this.rect = AnchoredRect.createSections(unitSize * 0.75, unitSize * 0.75, unitSize * 2.2, unitSize * 2.2);
|
|
1393
1880
|
break;
|
|
1394
1881
|
case 1:
|
|
1395
|
-
this.rect =
|
|
1882
|
+
this.rect = AnchoredRect.createSections(unitSize * 0.75, unitSize * 0.75, unitSize * 2, unitSize * 2);
|
|
1396
1883
|
break;
|
|
1397
1884
|
case 2:
|
|
1398
|
-
this.rect =
|
|
1885
|
+
this.rect = AnchoredRect.createSections(unitSize * 1, unitSize * 1, unitSize * 1, unitSize * 1);
|
|
1399
1886
|
break;
|
|
1400
1887
|
default:
|
|
1401
|
-
throw new
|
|
1888
|
+
throw new MusicError2(MusicErrorType2.Score, "Invalid accidental value: " + this.accidental);
|
|
1402
1889
|
}
|
|
1403
1890
|
}
|
|
1404
1891
|
offset(dx, dy) {
|
|
@@ -1438,7 +1925,6 @@ var ObjAccidental = class extends MusicObject {
|
|
|
1438
1925
|
};
|
|
1439
1926
|
|
|
1440
1927
|
// src/score/engine/obj-text.ts
|
|
1441
|
-
import { AnchoredRect as AnchoredRect5 } from "@tspro/ts-utils-lib";
|
|
1442
1928
|
var DefaultBoxedPadding = 0.5;
|
|
1443
1929
|
var ObjText = class extends MusicObject {
|
|
1444
1930
|
constructor(parent, text, anchorX, anchorY) {
|
|
@@ -1475,7 +1961,7 @@ var ObjText = class extends MusicObject {
|
|
|
1475
1961
|
if (this.textLines.length === 0) {
|
|
1476
1962
|
this.textLines = [""];
|
|
1477
1963
|
}
|
|
1478
|
-
this.rect = new
|
|
1964
|
+
this.rect = new AnchoredRect();
|
|
1479
1965
|
this.mi = new MText(this);
|
|
1480
1966
|
}
|
|
1481
1967
|
getMusicInterface() {
|
|
@@ -1484,18 +1970,6 @@ var ObjText = class extends MusicObject {
|
|
|
1484
1970
|
getText() {
|
|
1485
1971
|
return this.text;
|
|
1486
1972
|
}
|
|
1487
|
-
updateAnchorX(anchorX) {
|
|
1488
|
-
this.anchorX = anchorX;
|
|
1489
|
-
let { width } = this.rect;
|
|
1490
|
-
this.rect.left = this.rect.anchorX - width * anchorX;
|
|
1491
|
-
this.rect.right = this.rect.anchorX + width * (1 - anchorX);
|
|
1492
|
-
}
|
|
1493
|
-
updateAnchorY(anchorY) {
|
|
1494
|
-
this.anchorY = anchorY;
|
|
1495
|
-
let { height } = this.rect;
|
|
1496
|
-
this.rect.top = this.rect.anchorY - height * anchorY;
|
|
1497
|
-
this.rect.bottom = this.rect.anchorY + height * (1 - anchorY);
|
|
1498
|
-
}
|
|
1499
1973
|
pick(x, y) {
|
|
1500
1974
|
return this.rect.contains(x, y) ? [this] : [];
|
|
1501
1975
|
}
|
|
@@ -1511,7 +1985,7 @@ var ObjText = class extends MusicObject {
|
|
|
1511
1985
|
if (this.boxed === "square" || this.boxed === "circle") {
|
|
1512
1986
|
h = w = Math.max(h, w);
|
|
1513
1987
|
}
|
|
1514
|
-
this.rect =
|
|
1988
|
+
this.rect = AnchoredRect.createSections(w * anchorX, w * (1 - anchorX), h * anchorY, h * (1 - anchorY));
|
|
1515
1989
|
}
|
|
1516
1990
|
offset(dx, dy) {
|
|
1517
1991
|
this.rect.offsetInPlace(dx, dy);
|
|
@@ -1557,8 +2031,7 @@ var ObjText = class extends MusicObject {
|
|
|
1557
2031
|
};
|
|
1558
2032
|
|
|
1559
2033
|
// src/score/engine/obj-signature.ts
|
|
1560
|
-
import { MusicError as
|
|
1561
|
-
import { AnchoredRect as AnchoredRect6 } from "@tspro/ts-utils-lib";
|
|
2034
|
+
import { MusicError as MusicError3, MusicErrorType as MusicErrorType3 } from "@tspro/web-music-score/core";
|
|
1562
2035
|
var ObjStaffSignature = class extends MusicObject {
|
|
1563
2036
|
constructor(measure, staff) {
|
|
1564
2037
|
super(measure);
|
|
@@ -1575,22 +2048,29 @@ var ObjStaffSignature = class extends MusicObject {
|
|
|
1575
2048
|
__publicField(this, "mi");
|
|
1576
2049
|
this.mi = new MStaffSignature(this);
|
|
1577
2050
|
}
|
|
2051
|
+
get doc() {
|
|
2052
|
+
return this.measure.doc;
|
|
2053
|
+
}
|
|
1578
2054
|
getMusicInterface() {
|
|
1579
2055
|
return this.mi;
|
|
1580
2056
|
}
|
|
1581
2057
|
updateClefImage(ctx, showClef) {
|
|
1582
2058
|
if (showClef) {
|
|
1583
|
-
let
|
|
2059
|
+
let color = DocumentColor.Staff_Signature_Clef;
|
|
2060
|
+
if (["black", "#000", "#000000"].includes(color))
|
|
2061
|
+
color = "";
|
|
2062
|
+
let img = ctx.getImageAsset(this.staff.clefImageAsset, color);
|
|
1584
2063
|
this.clefImage = img ? new ObjImage(this, img, 0, 0.5, 0.1) : void 0;
|
|
1585
|
-
this.eightBelowClef = this.clefImage && this.staff.isOctaveDown ? new ObjText(this, "8", 0.5, 0) : void 0;
|
|
2064
|
+
this.eightBelowClef = this.clefImage && this.staff.isOctaveDown ? new ObjText(this, { text: "8", color }, 0.5, 0) : void 0;
|
|
1586
2065
|
} else {
|
|
1587
2066
|
this.clefImage = void 0;
|
|
1588
2067
|
}
|
|
1589
2068
|
}
|
|
1590
2069
|
updateMeasureNumber(showMeasureNumber) {
|
|
1591
2070
|
if (showMeasureNumber) {
|
|
2071
|
+
let color = DocumentColor.Staff_Signature_MeasureNum;
|
|
1592
2072
|
let text = this.measure.getMeasureNumber().toString();
|
|
1593
|
-
this.measureNumber = new ObjText(this, text, 0, 1);
|
|
2073
|
+
this.measureNumber = new ObjText(this, { text, color }, 0, 1);
|
|
1594
2074
|
} else {
|
|
1595
2075
|
this.measureNumber = void 0;
|
|
1596
2076
|
}
|
|
@@ -1598,6 +2078,7 @@ var ObjStaffSignature = class extends MusicObject {
|
|
|
1598
2078
|
updateKeySignature(showKeySignature) {
|
|
1599
2079
|
if (showKeySignature) {
|
|
1600
2080
|
let { measure } = this;
|
|
2081
|
+
let color = DocumentColor.Staff_Signature_Key;
|
|
1601
2082
|
let prevMeasure = measure.getPrevMeasure();
|
|
1602
2083
|
let prevKeySignature = prevMeasure ? prevMeasure.getKeySignature() : void 0;
|
|
1603
2084
|
let newKeySignature = measure.getKeySignature();
|
|
@@ -1605,11 +2086,11 @@ var ObjStaffSignature = class extends MusicObject {
|
|
|
1605
2086
|
this.ksNewAccidentals = [];
|
|
1606
2087
|
if (prevKeySignature && !KeySignature.equals(newKeySignature, prevKeySignature)) {
|
|
1607
2088
|
prevKeySignature.getOrderedAccidentalNotes().forEach((accNote) => {
|
|
1608
|
-
this.ksNeutralizeAccidentals.push(new ObjAccidental(this, this.getAccidentalDiatonicId(accNote), 0));
|
|
2089
|
+
this.ksNeutralizeAccidentals.push(new ObjAccidental(this, this.getAccidentalDiatonicId(accNote), 0, color));
|
|
1609
2090
|
});
|
|
1610
2091
|
}
|
|
1611
2092
|
newKeySignature.getOrderedAccidentalNotes().forEach((accNote) => {
|
|
1612
|
-
this.ksNewAccidentals.push(new ObjAccidental(this, this.getAccidentalDiatonicId(accNote), accNote.accidental));
|
|
2093
|
+
this.ksNewAccidentals.push(new ObjAccidental(this, this.getAccidentalDiatonicId(accNote), accNote.accidental, color));
|
|
1613
2094
|
});
|
|
1614
2095
|
} else {
|
|
1615
2096
|
this.ksNeutralizeAccidentals = [];
|
|
@@ -1619,18 +2100,20 @@ var ObjStaffSignature = class extends MusicObject {
|
|
|
1619
2100
|
updateTimeSignature(showTimeSignature) {
|
|
1620
2101
|
if (showTimeSignature) {
|
|
1621
2102
|
let timeSignature = this.measure.getTimeSignature();
|
|
2103
|
+
let color = DocumentColor.Staff_Signature_Time;
|
|
1622
2104
|
let beatCount = timeSignature.beatCount.toString();
|
|
1623
|
-
this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0.5, 0.5);
|
|
2105
|
+
this.beatCountText = new ObjText(this, { text: beatCount, color, scale: 1.4 }, 0.5, 0.5);
|
|
1624
2106
|
let beatSize = timeSignature.beatSize.toString();
|
|
1625
|
-
this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0.5, 0.5);
|
|
2107
|
+
this.beatSizeText = new ObjText(this, { text: beatSize, color, scale: 1.4 }, 0.5, 0.5);
|
|
1626
2108
|
} else {
|
|
1627
2109
|
this.beatCountText = this.beatSizeText = void 0;
|
|
1628
2110
|
}
|
|
1629
2111
|
}
|
|
1630
2112
|
updateTempo(showTempo) {
|
|
1631
2113
|
if (showTempo) {
|
|
1632
|
-
let
|
|
1633
|
-
|
|
2114
|
+
let color = DocumentColor.Staff_Signature_Tempo;
|
|
2115
|
+
let text = getTempoString(this.measure.getTempo());
|
|
2116
|
+
this.tempoText = new ObjText(this, { text, color }, 0.5, 1);
|
|
1634
2117
|
} else {
|
|
1635
2118
|
this.tempoText = void 0;
|
|
1636
2119
|
}
|
|
@@ -1654,7 +2137,7 @@ var ObjStaffSignature = class extends MusicObject {
|
|
|
1654
2137
|
if (bottomAccidentalDiatonicId !== void 0) {
|
|
1655
2138
|
return Note2.findNextDiatonicIdAbove(accNote.diatonicId, bottomAccidentalDiatonicId, false);
|
|
1656
2139
|
} else {
|
|
1657
|
-
throw new
|
|
2140
|
+
throw new MusicError3(MusicErrorType3.Score, "Cannot get accidental diatonicId because note has no accidental.");
|
|
1658
2141
|
}
|
|
1659
2142
|
}
|
|
1660
2143
|
pick(x, y) {
|
|
@@ -1717,7 +2200,7 @@ var ObjStaffSignature = class extends MusicObject {
|
|
|
1717
2200
|
let { staff } = this;
|
|
1718
2201
|
let paddingX = unitSize;
|
|
1719
2202
|
let x = 0;
|
|
1720
|
-
this.rect = new
|
|
2203
|
+
this.rect = new AnchoredRect();
|
|
1721
2204
|
if (this.clefImage) {
|
|
1722
2205
|
x += paddingX;
|
|
1723
2206
|
this.clefImage.layout(ctx);
|
|
@@ -1784,11 +2267,11 @@ var ObjStaffSignature = class extends MusicObject {
|
|
|
1784
2267
|
this.tempoText.layout(ctx);
|
|
1785
2268
|
this.tempoText.setCenterX(x);
|
|
1786
2269
|
this.tempoText.setBottom(staff.getTopLineY());
|
|
1787
|
-
if (this.clefImage &&
|
|
2270
|
+
if (this.clefImage && AnchoredRect.overlap(this.clefImage.getRect(), this.tempoText.getRect())) {
|
|
1788
2271
|
this.tempoText.setBottom(this.clefImage.getRect().top);
|
|
1789
2272
|
}
|
|
1790
2273
|
[...this.ksNeutralizeAccidentals, ...this.ksNewAccidentals].forEach((acc) => {
|
|
1791
|
-
if (this.tempoText &&
|
|
2274
|
+
if (this.tempoText && AnchoredRect.overlap(acc.getRect(), this.tempoText.getRect())) {
|
|
1792
2275
|
this.tempoText.setBottom(acc.getRect().top);
|
|
1793
2276
|
}
|
|
1794
2277
|
});
|
|
@@ -1835,10 +2318,14 @@ var ObjTabSignature = class extends MusicObject {
|
|
|
1835
2318
|
getMusicInterface() {
|
|
1836
2319
|
return this.mi;
|
|
1837
2320
|
}
|
|
2321
|
+
get doc() {
|
|
2322
|
+
return this.measure.doc;
|
|
2323
|
+
}
|
|
1838
2324
|
updateMeasureNumber(showMeasureNumber) {
|
|
1839
2325
|
if (showMeasureNumber) {
|
|
2326
|
+
let color = DocumentColor.Tab_Signature_MeasureNum;
|
|
1840
2327
|
let text = this.measure.getMeasureNumber().toString();
|
|
1841
|
-
this.measureNumber = new ObjText(this, text, 0, 1);
|
|
2328
|
+
this.measureNumber = new ObjText(this, { text, color }, 0, 1);
|
|
1842
2329
|
} else {
|
|
1843
2330
|
this.measureNumber = void 0;
|
|
1844
2331
|
}
|
|
@@ -1846,18 +2333,20 @@ var ObjTabSignature = class extends MusicObject {
|
|
|
1846
2333
|
updateTimeSignature(showTimeSignature) {
|
|
1847
2334
|
if (showTimeSignature) {
|
|
1848
2335
|
let timeSignature = this.measure.getTimeSignature();
|
|
2336
|
+
let color = DocumentColor.Tab_Signature_Time;
|
|
1849
2337
|
let beatCount = timeSignature.beatCount.toString();
|
|
1850
|
-
this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0.5, 0.5);
|
|
2338
|
+
this.beatCountText = new ObjText(this, { text: beatCount, color, scale: 1.4 }, 0.5, 0.5);
|
|
1851
2339
|
let beatSize = timeSignature.beatSize.toString();
|
|
1852
|
-
this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0.5, 0.5);
|
|
2340
|
+
this.beatSizeText = new ObjText(this, { text: beatSize, color, scale: 1.4 }, 0.5, 0.5);
|
|
1853
2341
|
} else {
|
|
1854
2342
|
this.beatCountText = this.beatSizeText = void 0;
|
|
1855
2343
|
}
|
|
1856
2344
|
}
|
|
1857
2345
|
updateTempo(showTempo) {
|
|
1858
2346
|
if (showTempo) {
|
|
1859
|
-
let
|
|
1860
|
-
|
|
2347
|
+
let color = DocumentColor.Tab_Signature_Tempo;
|
|
2348
|
+
let text = getTempoString(this.measure.getTempo());
|
|
2349
|
+
this.tempoText = new ObjText(this, { text, color }, 0, 1);
|
|
1861
2350
|
} else {
|
|
1862
2351
|
this.tempoText = void 0;
|
|
1863
2352
|
}
|
|
@@ -1899,7 +2388,7 @@ var ObjTabSignature = class extends MusicObject {
|
|
|
1899
2388
|
let paddingX = unitSize;
|
|
1900
2389
|
let x = 0;
|
|
1901
2390
|
let topLineY = tab.getTopLineY();
|
|
1902
|
-
this.rect = new
|
|
2391
|
+
this.rect = new AnchoredRect();
|
|
1903
2392
|
if (this.measureNumber) {
|
|
1904
2393
|
this.measureNumber.layout(ctx);
|
|
1905
2394
|
this.measureNumber.setLeft(0);
|
|
@@ -1950,7 +2439,6 @@ var ObjTabSignature = class extends MusicObject {
|
|
|
1950
2439
|
};
|
|
1951
2440
|
|
|
1952
2441
|
// src/score/engine/player.ts
|
|
1953
|
-
import { Rect as Rect2, UniMap as UniMap3, Utils as Utils5 } from "@tspro/ts-utils-lib";
|
|
1954
2442
|
import { NoteLength as NoteLength4, RhythmProps as RhythmProps4, alterTempoSpeed } from "@tspro/web-music-score/theory";
|
|
1955
2443
|
import * as Audio from "@tspro/web-music-score/audio";
|
|
1956
2444
|
|
|
@@ -1958,7 +2446,6 @@ import * as Audio from "@tspro/web-music-score/audio";
|
|
|
1958
2446
|
import { Note as Note5 } from "@tspro/web-music-score/theory";
|
|
1959
2447
|
|
|
1960
2448
|
// src/score/engine/obj-arpeggio.ts
|
|
1961
|
-
import { AnchoredRect as AnchoredRect7 } from "@tspro/ts-utils-lib";
|
|
1962
2449
|
var ObjArpeggio = class extends MusicObject {
|
|
1963
2450
|
constructor(col, line, arpeggioDir) {
|
|
1964
2451
|
super(col);
|
|
@@ -1989,7 +2476,7 @@ var ObjArpeggio = class extends MusicObject {
|
|
|
1989
2476
|
this.numCycles = Math.ceil((bottom - top) / this.cycleHeight) + 2;
|
|
1990
2477
|
let width = unitSize * 2;
|
|
1991
2478
|
let height = this.numCycles * this.cycleHeight;
|
|
1992
|
-
this.rect = new
|
|
2479
|
+
this.rect = new AnchoredRect(-width / 2, width / 2, -height / 2 - this.topArrowHeight, height / 2 + this.bottomArrowHeight);
|
|
1993
2480
|
}
|
|
1994
2481
|
offset(dx, dy) {
|
|
1995
2482
|
this.rect.offsetInPlace(dx, dy);
|
|
@@ -2025,8 +2512,7 @@ var ObjArpeggio = class extends MusicObject {
|
|
|
2025
2512
|
|
|
2026
2513
|
// src/score/engine/obj-rest.ts
|
|
2027
2514
|
import { Note as Note3, NoteLengthProps as NoteLengthProps2, RhythmProps as RhythmProps2, Tuplet } from "@tspro/web-music-score/theory";
|
|
2028
|
-
import { MusicError as
|
|
2029
|
-
import { AnchoredRect as AnchoredRect8 } from "@tspro/ts-utils-lib";
|
|
2515
|
+
import { MusicError as MusicError4, MusicErrorType as MusicErrorType4 } from "@tspro/web-music-score/core";
|
|
2030
2516
|
function getDiatonicIdFromStaffPos(staffPos) {
|
|
2031
2517
|
if (typeof staffPos === "number") {
|
|
2032
2518
|
return Note3.getChromaticNote(staffPos).diatonicId;
|
|
@@ -2043,7 +2529,7 @@ var ObjStaffRest = class extends MusicObject {
|
|
|
2043
2529
|
super(staff);
|
|
2044
2530
|
this.staff = staff;
|
|
2045
2531
|
this.rest = rest;
|
|
2046
|
-
__publicField(this, "restRect", new
|
|
2532
|
+
__publicField(this, "restRect", new AnchoredRect());
|
|
2047
2533
|
__publicField(this, "dotRects", []);
|
|
2048
2534
|
__publicField(this, "mi");
|
|
2049
2535
|
staff.addObject(this);
|
|
@@ -2091,7 +2577,7 @@ var _ObjRest = class _ObjRest extends MusicObject {
|
|
|
2091
2577
|
}
|
|
2092
2578
|
this.runningDiatonicId = this.setDiatonicId;
|
|
2093
2579
|
this.runningStemDir = "up" /* Up */;
|
|
2094
|
-
this.color = (_c = options == null ? void 0 : options.color) != null ? _c :
|
|
2580
|
+
this.color = (_c = options == null ? void 0 : options.color) != null ? _c : DocumentColor.Staff_Rest;
|
|
2095
2581
|
this.hide = (_d = options == null ? void 0 : options.hide) != null ? _d : false;
|
|
2096
2582
|
this.oldStyleTriplet = tupletRatio === void 0 && ((options == null ? void 0 : options.triplet) === true || NoteLengthProps2.get(noteLength).isTriplet);
|
|
2097
2583
|
let dotCount = typeof (options == null ? void 0 : options.dotted) === "number" ? options.dotted > 0 ? options.dotted : void 0 : (options == null ? void 0 : options.dotted) === true ? 1 : void 0;
|
|
@@ -2200,7 +2686,7 @@ var _ObjRest = class _ObjRest extends MusicObject {
|
|
|
2200
2686
|
case 64:
|
|
2201
2687
|
return -3;
|
|
2202
2688
|
default:
|
|
2203
|
-
throw new
|
|
2689
|
+
throw new MusicError4(MusicErrorType4.Score, `Get rest dot vertical displacement: Invalid note size: ${noteSize}`);
|
|
2204
2690
|
}
|
|
2205
2691
|
}
|
|
2206
2692
|
updateAccidentalState(accState) {
|
|
@@ -2224,7 +2710,7 @@ var _ObjRest = class _ObjRest extends MusicObject {
|
|
|
2224
2710
|
let dotWidth = DocumentSettings.DotSize * unitSize;
|
|
2225
2711
|
let dotX = obj.restRect.rightw + (DocumentSettings.RestDotSpace + DocumentSettings.DotSize * unitSize) + i * DocumentSettings.DotSize * unitSize * 1.5;
|
|
2226
2712
|
let dotY = this.getRestDotVerticalDisplacement(noteSize) * unitSize;
|
|
2227
|
-
obj.dotRects.push(
|
|
2713
|
+
obj.dotRects.push(AnchoredRect.createCentered(dotX, dotY, dotWidth, dotWidth));
|
|
2228
2714
|
}
|
|
2229
2715
|
obj.setAnchor(0, staff.getDiatonicIdY(diatonicId));
|
|
2230
2716
|
this.staffObjects.push(obj);
|
|
@@ -2233,7 +2719,7 @@ var _ObjRest = class _ObjRest extends MusicObject {
|
|
|
2233
2719
|
}
|
|
2234
2720
|
updateRect() {
|
|
2235
2721
|
if (this.staffObjects.length === 0) {
|
|
2236
|
-
this.rect = new
|
|
2722
|
+
this.rect = new AnchoredRect();
|
|
2237
2723
|
} else {
|
|
2238
2724
|
this.rect = this.staffObjects[0].getRect().clone();
|
|
2239
2725
|
if (this.staffObjects.length > 1) {
|
|
@@ -2265,18 +2751,17 @@ __publicField(_ObjRest, "UndefinedDiatonicId", Infinity);
|
|
|
2265
2751
|
var ObjRest = _ObjRest;
|
|
2266
2752
|
|
|
2267
2753
|
// src/score/engine/obj-note-group.ts
|
|
2268
|
-
import { AnchoredRect as AnchoredRect9, Guard as Guard2, Utils as Utils3 } from "@tspro/ts-utils-lib";
|
|
2269
2754
|
import { Note as Note4, NoteLengthProps as NoteLengthProps3, RhythmProps as RhythmProps3, Tuplet as Tuplet2 } from "@tspro/web-music-score/theory";
|
|
2270
|
-
import { MusicError as
|
|
2755
|
+
import { MusicError as MusicError5, MusicErrorType as MusicErrorType5 } from "@tspro/web-music-score/core";
|
|
2271
2756
|
function getArpeggio(a) {
|
|
2272
|
-
return
|
|
2757
|
+
return guard_exports.isEnumValue(a, Arpeggio) ? a : a === true ? "up" /* Up */ : void 0;
|
|
2273
2758
|
}
|
|
2274
2759
|
function sortNotesAndStrings(notes, strings) {
|
|
2275
|
-
let stringArr =
|
|
2760
|
+
let stringArr = utils_exports.Arr.isArray(strings) ? strings : strings !== void 0 ? [strings] : [];
|
|
2276
2761
|
let noteStringData = notes.map((note, i) => {
|
|
2277
2762
|
return { note, string: stringArr[i] };
|
|
2278
2763
|
});
|
|
2279
|
-
noteStringData =
|
|
2764
|
+
noteStringData = utils_exports.Arr.removeDuplicates(noteStringData, (a, b) => Note4.equals(a.note, b.note)).sort((a, b) => Note4.compareFunc(a.note, b.note));
|
|
2280
2765
|
return {
|
|
2281
2766
|
sortedNotes: noteStringData.map((e) => e.note),
|
|
2282
2767
|
sortedStrings: noteStringData.every((e) => e.string === void 0) ? void 0 : noteStringData.map((e) => e.string)
|
|
@@ -2398,8 +2883,8 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2398
2883
|
__publicField(this, "tabObjects", []);
|
|
2399
2884
|
__publicField(this, "isNoteDisplaced");
|
|
2400
2885
|
__publicField(this, "mi");
|
|
2401
|
-
if (!
|
|
2402
|
-
throw new
|
|
2886
|
+
if (!guard_exports.isIntegerGte(notes.length, 1)) {
|
|
2887
|
+
throw new MusicError5(MusicErrorType5.Score, "Cannot create note group object because notes array is empty.");
|
|
2403
2888
|
}
|
|
2404
2889
|
let { sortedNotes, sortedStrings } = sortNotesAndStrings(notes, options == null ? void 0 : options.string);
|
|
2405
2890
|
this.notes = sortedNotes;
|
|
@@ -2409,7 +2894,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2409
2894
|
this.runningDiatonicId = this.setDiatonicId;
|
|
2410
2895
|
this.runningStemDir = "up" /* Up */;
|
|
2411
2896
|
this.runningStringNumbers = [];
|
|
2412
|
-
this.color = (_a = options == null ? void 0 : options.color) != null ? _a :
|
|
2897
|
+
this.color = (_a = options == null ? void 0 : options.color) != null ? _a : DocumentColor.Staff_Note;
|
|
2413
2898
|
this.staccato = (_b = options == null ? void 0 : options.staccato) != null ? _b : false;
|
|
2414
2899
|
this.diamond = (_c = options == null ? void 0 : options.diamond) != null ? _c : false;
|
|
2415
2900
|
this.arpeggio = getArpeggio(options == null ? void 0 : options.arpeggio);
|
|
@@ -2451,9 +2936,9 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2451
2936
|
}
|
|
2452
2937
|
startConnective(connectiveProps) {
|
|
2453
2938
|
if (!this.row.hasStaff && connectiveProps.connective === "tie" /* Tie */) {
|
|
2454
|
-
throw new
|
|
2939
|
+
throw new MusicError5(MusicErrorType5.Score, "Ties not implemented for guitar tabs alone, staff is required!");
|
|
2455
2940
|
} else if (!this.row.hasStaff && connectiveProps.connective === "slur" /* Slur */) {
|
|
2456
|
-
throw new
|
|
2941
|
+
throw new MusicError5(MusicErrorType5.Score, "Slurs not implemented for guitar tabs alone, staff is required!");
|
|
2457
2942
|
}
|
|
2458
2943
|
this.startConnnectives.push(connectiveProps);
|
|
2459
2944
|
this.doc.addConnectiveProps(connectiveProps);
|
|
@@ -2491,7 +2976,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2491
2976
|
var _a;
|
|
2492
2977
|
if (line instanceof ObjStaff) {
|
|
2493
2978
|
if (noteIndex < 0 || noteIndex >= this.notes.length) {
|
|
2494
|
-
throw new
|
|
2979
|
+
throw new MusicError5(MusicErrorType5.Score, "Invalid noteIndex: " + noteIndex);
|
|
2495
2980
|
}
|
|
2496
2981
|
let obj = this.staffObjects.find((obj2) => obj2.staff === line);
|
|
2497
2982
|
if (!obj || noteIndex < 0 || noteIndex >= obj.noteHeadRects.length) {
|
|
@@ -2539,7 +3024,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2539
3024
|
case "stemTip" /* StemTip */:
|
|
2540
3025
|
return { x: anchorX, y: stemTip.anchorY + (stemDir === "up" /* Up */ ? -padding : padding) };
|
|
2541
3026
|
default:
|
|
2542
|
-
throw new
|
|
3027
|
+
throw new MusicError5(MusicErrorType5.Score, "Invalid noteAnchor: " + noteAnchor);
|
|
2543
3028
|
}
|
|
2544
3029
|
} else if (line instanceof ObjTab) {
|
|
2545
3030
|
let fretNumber = (_a = this.tabObjects.find((obj) => obj.tab === line)) == null ? void 0 : _a.fretNumbers[noteIndex];
|
|
@@ -2689,7 +3174,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2689
3174
|
if (j >= 0) {
|
|
2690
3175
|
tieNoteGroups = tieNoteGroups.slice(0, j);
|
|
2691
3176
|
}
|
|
2692
|
-
return
|
|
3177
|
+
return utils_exports.Math.sum(tieNoteGroups.map((ng) => ng.rhythmProps.ticks));
|
|
2693
3178
|
});
|
|
2694
3179
|
return tiedTicks.length === 0 ? this.rhythmProps.ticks : Math.max(...tiedTicks);
|
|
2695
3180
|
}
|
|
@@ -2728,7 +3213,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2728
3213
|
if (isTopNote && stemDir === "up" /* Up */) stemTipStaff = noteStaff;
|
|
2729
3214
|
if (isBottomNote && stemDir === "down" /* Down */) stemTipStaff = noteStaff;
|
|
2730
3215
|
if (isTopNote && stemDir === "down" /* Down */) stemBaseStaff = noteStaff;
|
|
2731
|
-
let noteHeadRect = obj.noteHeadRects[noteIndex] =
|
|
3216
|
+
let noteHeadRect = obj.noteHeadRects[noteIndex] = AnchoredRect.createCentered(noteX, noteY, noteHeadWidth, noteHeadHeight);
|
|
2732
3217
|
noteStaff.addObject(noteHeadRect);
|
|
2733
3218
|
if (accState.needAccidental(note)) {
|
|
2734
3219
|
let acc = obj.accidentals[noteIndex] = new ObjAccidental(this, note.diatonicId, note.accidental, this.color);
|
|
@@ -2744,7 +3229,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2744
3229
|
for (let i = 0; i < dotCount; i++) {
|
|
2745
3230
|
let dotX = noteHeadRect.right + DocumentSettings.NoteDotSpace * unitSize + dotWidth / 2 + i * dotWidth * 1.5;
|
|
2746
3231
|
let dotY = noteY + this.getDotVerticalDisplacement(staff, note.diatonicId, stemDir) * unitSize;
|
|
2747
|
-
let r =
|
|
3232
|
+
let r = AnchoredRect.createCentered(dotX, dotY, dotWidth, dotWidth);
|
|
2748
3233
|
obj.dotRects.push(r);
|
|
2749
3234
|
noteStaff.addObject(r);
|
|
2750
3235
|
}
|
|
@@ -2752,13 +3237,13 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2752
3237
|
if (stemDir === "up" /* Up */ && isBottomNote) {
|
|
2753
3238
|
let dotX = noteX;
|
|
2754
3239
|
let dotY = noteY + unitSize * (isNoteOnLine ? 3 : 2);
|
|
2755
|
-
let r =
|
|
3240
|
+
let r = AnchoredRect.createCentered(dotX, dotY, dotWidth, dotWidth);
|
|
2756
3241
|
obj.dotRects.push(r);
|
|
2757
3242
|
stemBaseStaff.addObject(r);
|
|
2758
3243
|
} else if (stemDir === "down" /* Down */ && isTopNote) {
|
|
2759
3244
|
let dotX = noteX;
|
|
2760
3245
|
let dotY = noteY - unitSize * (isNoteOnLine ? 3 : 2);
|
|
2761
|
-
let r =
|
|
3246
|
+
let r = AnchoredRect.createCentered(dotX, dotY, dotWidth, dotWidth);
|
|
2762
3247
|
obj.dotRects.push(r);
|
|
2763
3248
|
stemBaseStaff.addObject(r);
|
|
2764
3249
|
}
|
|
@@ -2771,8 +3256,8 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2771
3256
|
let stemTipY = stemDir === "up" /* Up */ ? topNoteY - stemHeight : bottomNoteY + stemHeight;
|
|
2772
3257
|
let stemBaseY = stemDir === "up" /* Up */ ? bottomNoteY : topNoteY;
|
|
2773
3258
|
if (hasStem) {
|
|
2774
|
-
obj.stemTip = new
|
|
2775
|
-
obj.stemBase = new
|
|
3259
|
+
obj.stemTip = new AnchoredRect(stemX, stemX, stemTipY, stemTipY);
|
|
3260
|
+
obj.stemBase = new AnchoredRect(stemX, stemX, stemBaseY, stemBaseY);
|
|
2776
3261
|
stemTipStaff.addObject(obj.stemTip);
|
|
2777
3262
|
stemBaseStaff.addObject(obj.stemBase);
|
|
2778
3263
|
}
|
|
@@ -2781,7 +3266,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2781
3266
|
let flagHeight = flagCount === 0 ? 0 : DocumentSettings.FlagHeight * unitSize;
|
|
2782
3267
|
for (let i = 0; i < flagCount; i++) {
|
|
2783
3268
|
let flagAddY = i * unitSize * DocumentSettings.FlagSeparation;
|
|
2784
|
-
let r = obj.flagRects[i] = stemDir === "up" /* Up */ ? new
|
|
3269
|
+
let r = obj.flagRects[i] = stemDir === "up" /* Up */ ? new AnchoredRect(stemX, stemX + flagWidth, stemTipY + flagAddY, stemTipY + flagHeight + flagAddY) : new AnchoredRect(stemX, stemX + flagWidth, stemTipY - flagHeight - flagAddY, stemTipY - flagAddY);
|
|
2785
3270
|
stemTipStaff.addObject(r);
|
|
2786
3271
|
}
|
|
2787
3272
|
}
|
|
@@ -2794,12 +3279,13 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2794
3279
|
return;
|
|
2795
3280
|
}
|
|
2796
3281
|
let obj = new ObjTabNoteGroup(tab, this);
|
|
3282
|
+
const bgcolor = DocumentColor.Background;
|
|
3283
|
+
const color = DocumentColor.Tab_Note;
|
|
2797
3284
|
this.notes.forEach((note, noteIndex) => {
|
|
2798
3285
|
let stringNumber = this.runningStringNumbers[noteIndex];
|
|
2799
|
-
if (
|
|
3286
|
+
if (guard_exports.isIntegerBetween(stringNumber, 1, 6)) {
|
|
2800
3287
|
let fretId = note.chromaticId - tab.getTuningStrings()[stringNumber - 1].chromaticId;
|
|
2801
|
-
let
|
|
2802
|
-
let fretNumber = new ObjText(this, { text: String(fretId), color, bgcolor: "white" }, 0.5, 0.5);
|
|
3288
|
+
let fretNumber = new ObjText(this, { text: String(fretId), color, bgcolor }, 0.5, 0.5);
|
|
2803
3289
|
fretNumber.layout(ctx);
|
|
2804
3290
|
fretNumber.setAnchor(this.col.getRect().anchorX, tab.getStringY(stringNumber - 1));
|
|
2805
3291
|
obj.fretNumbers.push(fretNumber);
|
|
@@ -2818,7 +3304,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2818
3304
|
} else if (this.tabObjects.length > 0 && this.tabObjects[0].fretNumbers.length > 0) {
|
|
2819
3305
|
this.rect = this.tabObjects[0].fretNumbers[0].getRect().clone();
|
|
2820
3306
|
} else {
|
|
2821
|
-
this.rect = new
|
|
3307
|
+
this.rect = new AnchoredRect();
|
|
2822
3308
|
return;
|
|
2823
3309
|
}
|
|
2824
3310
|
this.staffObjects.forEach((obj) => this.rect.expandInPlace(obj.getRect()));
|
|
@@ -2915,8 +3401,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2915
3401
|
};
|
|
2916
3402
|
|
|
2917
3403
|
// src/score/engine/obj-rhythm-column.ts
|
|
2918
|
-
import { MusicError as
|
|
2919
|
-
import { IndexArray, UniMap as UniMap2, TriMap, AnchoredRect as AnchoredRect10 } from "@tspro/ts-utils-lib";
|
|
3404
|
+
import { MusicError as MusicError6, MusicErrorType as MusicErrorType6 } from "@tspro/web-music-score/core";
|
|
2920
3405
|
var ObjRhythmColumn = class extends MusicObject {
|
|
2921
3406
|
constructor(measure, positionTicks) {
|
|
2922
3407
|
super(measure);
|
|
@@ -2926,8 +3411,8 @@ var ObjRhythmColumn = class extends MusicObject {
|
|
|
2926
3411
|
__publicField(this, "lyricsObject", new TriMap());
|
|
2927
3412
|
__publicField(this, "minDiatonicId");
|
|
2928
3413
|
__publicField(this, "maxDiatonicId");
|
|
2929
|
-
__publicField(this, "staffMinDiatonicId", new
|
|
2930
|
-
__publicField(this, "staffMaxDiatonicId", new
|
|
3414
|
+
__publicField(this, "staffMinDiatonicId", new UniMap());
|
|
3415
|
+
__publicField(this, "staffMaxDiatonicId", new UniMap());
|
|
2931
3416
|
__publicField(this, "arpeggioDir");
|
|
2932
3417
|
__publicField(this, "arpeggios", []);
|
|
2933
3418
|
__publicField(this, "playerProps");
|
|
@@ -2952,7 +3437,7 @@ var ObjRhythmColumn = class extends MusicObject {
|
|
|
2952
3437
|
if (colId >= 0 && colId < this.measure.getColumnCount()) {
|
|
2953
3438
|
return this.measure.getColumn(colId + 1);
|
|
2954
3439
|
} else {
|
|
2955
|
-
throw new
|
|
3440
|
+
throw new MusicError6(MusicErrorType6.Score, "Cannot get next column in measure because current column's id in mesure is invalid.");
|
|
2956
3441
|
}
|
|
2957
3442
|
}
|
|
2958
3443
|
/**
|
|
@@ -3142,7 +3627,7 @@ var ObjRhythmColumn = class extends MusicObject {
|
|
|
3142
3627
|
return;
|
|
3143
3628
|
}
|
|
3144
3629
|
let { row } = this;
|
|
3145
|
-
this.rect = new
|
|
3630
|
+
this.rect = new AnchoredRect();
|
|
3146
3631
|
this.requestRectUpdate();
|
|
3147
3632
|
let leftw = 0;
|
|
3148
3633
|
let rightw = 0;
|
|
@@ -3259,6 +3744,7 @@ var ObjRhythmColumn = class extends MusicObject {
|
|
|
3259
3744
|
this.rect.offsetInPlace(dx, dy);
|
|
3260
3745
|
}
|
|
3261
3746
|
draw(ctx) {
|
|
3747
|
+
ctx.color(DocumentColor.Staff_Frame);
|
|
3262
3748
|
this.row.getStaves().forEach((staff) => {
|
|
3263
3749
|
let minDiatonicId = this.staffMinDiatonicId.get(staff);
|
|
3264
3750
|
let maxDiatonicId = this.staffMaxDiatonicId.get(staff);
|
|
@@ -3274,35 +3760,29 @@ var ObjRhythmColumn = class extends MusicObject {
|
|
|
3274
3760
|
}
|
|
3275
3761
|
};
|
|
3276
3762
|
|
|
3277
|
-
// src/score/engine/extension.ts
|
|
3278
|
-
import { MusicError as MusicError8, MusicErrorType as MusicErrorType8 } from "@tspro/web-music-score/core";
|
|
3279
|
-
|
|
3280
|
-
// src/score/engine/element-data.ts
|
|
3281
|
-
import { Guard as Guard3, Utils as Utils4 } from "@tspro/ts-utils-lib";
|
|
3282
|
-
|
|
3283
3763
|
// src/score/engine/obj-special-text.ts
|
|
3284
|
-
import { AnchoredRect as AnchoredRect11 } from "@tspro/ts-utils-lib";
|
|
3285
3764
|
var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
|
|
3286
|
-
constructor(parent, text) {
|
|
3765
|
+
constructor(parent, text, color = "black") {
|
|
3287
3766
|
super(parent);
|
|
3288
3767
|
this.text = text;
|
|
3768
|
+
this.color = color;
|
|
3289
3769
|
__publicField(this, "components", []);
|
|
3290
3770
|
__publicField(this, "mi");
|
|
3291
3771
|
switch (this.text) {
|
|
3292
3772
|
case _ObjSpecialText.Coda:
|
|
3293
3773
|
this.components = [
|
|
3294
|
-
new ObjText(this, { text: "\u{1D10C}", scale: 1.7 }, 0.5, 0.3),
|
|
3295
|
-
new ObjText(this, " Coda", 0, 1)
|
|
3774
|
+
new ObjText(this, { text: "\u{1D10C}", scale: 1.7, color }, 0.5, 0.3),
|
|
3775
|
+
new ObjText(this, { text: " Coda", color }, 0, 1)
|
|
3296
3776
|
];
|
|
3297
3777
|
break;
|
|
3298
3778
|
case _ObjSpecialText.toCoda:
|
|
3299
3779
|
this.components = [
|
|
3300
|
-
new ObjText(this, "toCoda ", 1, 1),
|
|
3301
|
-
new ObjText(this, { text: "\u{1D10C}", scale: 1.7 }, 0.5, 0.3)
|
|
3780
|
+
new ObjText(this, { text: "toCoda ", color }, 1, 1),
|
|
3781
|
+
new ObjText(this, { text: "\u{1D10C}", scale: 1.7, color }, 0.5, 0.3)
|
|
3302
3782
|
];
|
|
3303
3783
|
break;
|
|
3304
3784
|
case _ObjSpecialText.Segno:
|
|
3305
|
-
this.components = [new ObjText(this, { text: "\u{1D10B}", scale: 1.1 }, 0.5, 1)];
|
|
3785
|
+
this.components = [new ObjText(this, { text: "\u{1D10B}", scale: 1.1, color }, 0.5, 1)];
|
|
3306
3786
|
break;
|
|
3307
3787
|
default:
|
|
3308
3788
|
this.components = [];
|
|
@@ -3328,7 +3808,7 @@ var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
|
|
|
3328
3808
|
codaText.layout(ctx);
|
|
3329
3809
|
codaSym.setAnchorY(codaText.getRect().centerY);
|
|
3330
3810
|
codaText.setLeft(codaSym.getRect().right);
|
|
3331
|
-
this.rect = new
|
|
3811
|
+
this.rect = new AnchoredRect(
|
|
3332
3812
|
codaSym.getRect().left,
|
|
3333
3813
|
codaSym.getRect().anchorX,
|
|
3334
3814
|
codaText.getRect().right,
|
|
@@ -3345,7 +3825,7 @@ var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
|
|
|
3345
3825
|
codaSym.layout(ctx);
|
|
3346
3826
|
codaSym.setAnchorY(toCodaText.getRect().centerY);
|
|
3347
3827
|
toCodaText.setRight(codaSym.getRect().left);
|
|
3348
|
-
this.rect = new
|
|
3828
|
+
this.rect = new AnchoredRect(
|
|
3349
3829
|
toCodaText.getRect().left,
|
|
3350
3830
|
codaSym.getRect().anchorX,
|
|
3351
3831
|
codaSym.getRect().right,
|
|
@@ -3377,6 +3857,84 @@ __publicField(_ObjSpecialText, "Coda", "Coda \u{1D10C}");
|
|
|
3377
3857
|
__publicField(_ObjSpecialText, "Segno", "\u{1D10B}");
|
|
3378
3858
|
var ObjSpecialText = _ObjSpecialText;
|
|
3379
3859
|
|
|
3860
|
+
// src/score/engine/extension.ts
|
|
3861
|
+
function getTextContent(obj) {
|
|
3862
|
+
if (obj instanceof ObjText || obj instanceof ObjSpecialText)
|
|
3863
|
+
return obj.getText();
|
|
3864
|
+
if (obj instanceof ObjMeasure)
|
|
3865
|
+
return "[measure]";
|
|
3866
|
+
return "";
|
|
3867
|
+
}
|
|
3868
|
+
var ExtensionRange = class {
|
|
3869
|
+
constructor(startColumn) {
|
|
3870
|
+
this.startColumn = startColumn;
|
|
3871
|
+
__publicField(this, "columnRange");
|
|
3872
|
+
__publicField(this, "stopObject");
|
|
3873
|
+
this.columnRange = [startColumn];
|
|
3874
|
+
}
|
|
3875
|
+
get endColumn() {
|
|
3876
|
+
return this.columnRange[this.columnRange.length - 1];
|
|
3877
|
+
}
|
|
3878
|
+
addColumn(col) {
|
|
3879
|
+
if (this.endColumn !== col) this.columnRange.push(col);
|
|
3880
|
+
}
|
|
3881
|
+
setStopObject(obj) {
|
|
3882
|
+
this.stopObject = obj;
|
|
3883
|
+
}
|
|
3884
|
+
};
|
|
3885
|
+
var _Extension = class _Extension extends MusicObjectLink {
|
|
3886
|
+
constructor(headObj, startColumn, length, visible, lineStyle, linePos) {
|
|
3887
|
+
super(headObj.musicObj);
|
|
3888
|
+
this.headObj = headObj;
|
|
3889
|
+
__publicField(this, "length");
|
|
3890
|
+
__publicField(this, "visible");
|
|
3891
|
+
__publicField(this, "lineStyle");
|
|
3892
|
+
__publicField(this, "linePos");
|
|
3893
|
+
__publicField(this, "startColumn");
|
|
3894
|
+
this.length = length + 1;
|
|
3895
|
+
this.visible = visible;
|
|
3896
|
+
this.lineStyle = lineStyle;
|
|
3897
|
+
this.linePos = linePos;
|
|
3898
|
+
this.startColumn = startColumn;
|
|
3899
|
+
}
|
|
3900
|
+
isVisible() {
|
|
3901
|
+
return this.visible;
|
|
3902
|
+
}
|
|
3903
|
+
getLineStyle() {
|
|
3904
|
+
return this.lineStyle;
|
|
3905
|
+
}
|
|
3906
|
+
getLinePos() {
|
|
3907
|
+
return this.linePos;
|
|
3908
|
+
}
|
|
3909
|
+
whatStopped(col) {
|
|
3910
|
+
const m = col.measure;
|
|
3911
|
+
const cols = m.getColumns();
|
|
3912
|
+
const stoppingCol = col.getAnchoredLayoutObjects().filter((obj) => obj !== this.headObj && obj.layoutGroupId === this.headObj.layoutGroupId).map((obj) => obj.musicObj).filter((obj) => obj instanceof ObjText || obj instanceof ObjSpecialText)[0];
|
|
3913
|
+
return stoppingCol ? stoppingCol : col === cols[cols.length - 1] && m.hasEndSection() || m.hasEndSong() || _Extension.StopNavigations.some((nav) => m.hasNavigation(nav)) ? m.getBarLineRight() : void 0;
|
|
3914
|
+
}
|
|
3915
|
+
getRange() {
|
|
3916
|
+
let { startColumn, length } = this;
|
|
3917
|
+
let curColumn = startColumn;
|
|
3918
|
+
let range = new ExtensionRange(curColumn);
|
|
3919
|
+
let ticksLeft = length;
|
|
3920
|
+
while (true) {
|
|
3921
|
+
if (ticksLeft <= 0) return range;
|
|
3922
|
+
const stopObject = this.whatStopped(curColumn);
|
|
3923
|
+
if (stopObject !== void 0) {
|
|
3924
|
+
range.setStopObject(stopObject);
|
|
3925
|
+
return range;
|
|
3926
|
+
}
|
|
3927
|
+
ticksLeft -= curColumn.getTicksToNextColumn();
|
|
3928
|
+
curColumn = curColumn.getNextColumn();
|
|
3929
|
+
if (!curColumn) return range;
|
|
3930
|
+
if (ticksLeft > 0)
|
|
3931
|
+
range.addColumn(curColumn);
|
|
3932
|
+
}
|
|
3933
|
+
}
|
|
3934
|
+
};
|
|
3935
|
+
__publicField(_Extension, "StopNavigations", ["endRepeat" /* EndRepeat */, "ending" /* Ending */]);
|
|
3936
|
+
var Extension = _Extension;
|
|
3937
|
+
|
|
3380
3938
|
// src/score/engine/element-data.ts
|
|
3381
3939
|
function getNavigationString(navigation) {
|
|
3382
3940
|
switch (navigation) {
|
|
@@ -3400,140 +3958,24 @@ function getNavigationString(navigation) {
|
|
|
3400
3958
|
return navigation[0].toUpperCase() + navigation.substring(1);
|
|
3401
3959
|
}
|
|
3402
3960
|
}
|
|
3403
|
-
function isDynamicsText(text) {
|
|
3404
|
-
return Guard3.isEnumValue(text, DynamicsAnnotation);
|
|
3405
|
-
}
|
|
3406
3961
|
function getDynamicsVolume(text) {
|
|
3407
3962
|
if (/^(p+|f+|m|mp|mf)$/.test(text)) {
|
|
3408
|
-
let volume = 0.5 -
|
|
3409
|
-
return
|
|
3963
|
+
let volume = 0.5 - utils_exports.Str.charCount(text, "p") * 0.1 + utils_exports.Str.charCount(text, "f") * 0.1;
|
|
3964
|
+
return utils_exports.Math.clamp(volume, 0, 1);
|
|
3410
3965
|
} else {
|
|
3411
3966
|
return void 0;
|
|
3412
3967
|
}
|
|
3413
3968
|
}
|
|
3414
|
-
function isTempoText(text) {
|
|
3415
|
-
return Guard3.isEnumValue(text, TempoAnnotation);
|
|
3416
|
-
}
|
|
3417
3969
|
function getAnnotation(text) {
|
|
3418
|
-
if (
|
|
3970
|
+
if (guard_exports.isEnumValue(text, DynamicsAnnotation)) {
|
|
3419
3971
|
return "dynamics" /* Dynamics */;
|
|
3420
|
-
} else if (
|
|
3972
|
+
} else if (guard_exports.isEnumValue(text, TempoAnnotation)) {
|
|
3421
3973
|
return "tempo" /* Tempo */;
|
|
3422
3974
|
} else {
|
|
3423
3975
|
return void 0;
|
|
3424
3976
|
}
|
|
3425
3977
|
}
|
|
3426
3978
|
|
|
3427
|
-
// src/score/engine/extension.ts
|
|
3428
|
-
function getTextAnchorY(linePos) {
|
|
3429
|
-
switch (linePos) {
|
|
3430
|
-
case "bottom":
|
|
3431
|
-
return 0.8;
|
|
3432
|
-
case "middle":
|
|
3433
|
-
return 0.5;
|
|
3434
|
-
}
|
|
3435
|
-
}
|
|
3436
|
-
function getContext(elementText) {
|
|
3437
|
-
if (isDynamicsText(elementText)) {
|
|
3438
|
-
return 2 /* Volume */;
|
|
3439
|
-
} else if (isTempoText(elementText)) {
|
|
3440
|
-
return 1 /* Tempo */;
|
|
3441
|
-
} else {
|
|
3442
|
-
return 0 /* Undefined */;
|
|
3443
|
-
}
|
|
3444
|
-
}
|
|
3445
|
-
var Extension = class extends MusicObjectLink {
|
|
3446
|
-
constructor(head, startColumn, length, visible, lineStyle, linePos) {
|
|
3447
|
-
super(head);
|
|
3448
|
-
__publicField(this, "length");
|
|
3449
|
-
__publicField(this, "visible");
|
|
3450
|
-
__publicField(this, "lineStyle");
|
|
3451
|
-
__publicField(this, "linePos");
|
|
3452
|
-
__publicField(this, "startColumn");
|
|
3453
|
-
__publicField(this, "context");
|
|
3454
|
-
this.length = length;
|
|
3455
|
-
this.visible = visible;
|
|
3456
|
-
this.lineStyle = lineStyle;
|
|
3457
|
-
this.linePos = linePos;
|
|
3458
|
-
this.startColumn = startColumn;
|
|
3459
|
-
this.context = head instanceof ObjText ? getContext(head.getText()) : 0 /* Undefined */;
|
|
3460
|
-
if (head instanceof ObjText) {
|
|
3461
|
-
head.updateAnchorY(getTextAnchorY(linePos));
|
|
3462
|
-
} else {
|
|
3463
|
-
throw new MusicError8(MusicErrorType8.Score, "Update anchor's y-coordinate is only implemented for text objects.");
|
|
3464
|
-
}
|
|
3465
|
-
}
|
|
3466
|
-
isVisible() {
|
|
3467
|
-
return this.visible;
|
|
3468
|
-
}
|
|
3469
|
-
getLineStyle() {
|
|
3470
|
-
return this.lineStyle;
|
|
3471
|
-
}
|
|
3472
|
-
getLinePos() {
|
|
3473
|
-
return this.linePos;
|
|
3474
|
-
}
|
|
3475
|
-
getSpanBreakText(col, context) {
|
|
3476
|
-
if (col === col.measure.getColumn(0)) {
|
|
3477
|
-
let prevMeasure = col.measure.getPrevMeasure();
|
|
3478
|
-
if (prevMeasure) {
|
|
3479
|
-
if (prevMeasure.hasEndSection() || prevMeasure.hasEndSong()) {
|
|
3480
|
-
return "section-break";
|
|
3481
|
-
}
|
|
3482
|
-
let elemArr = ["endRepeat" /* EndRepeat */, "ending" /* Ending */];
|
|
3483
|
-
for (let i = 0; i < elemArr.length; i++) {
|
|
3484
|
-
if (prevMeasure.hasNavigation(elemArr[i])) {
|
|
3485
|
-
return "section-break";
|
|
3486
|
-
}
|
|
3487
|
-
}
|
|
3488
|
-
}
|
|
3489
|
-
}
|
|
3490
|
-
if (context === 1 /* Tempo */) {
|
|
3491
|
-
let objArr = col.getAnchoredLayoutObjects();
|
|
3492
|
-
for (let i = 0; i < objArr.length; i++) {
|
|
3493
|
-
let text = objArr[i].getTextContent();
|
|
3494
|
-
if (text && isTempoText(text)) {
|
|
3495
|
-
return text;
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
} else if (context === 2 /* Volume */) {
|
|
3499
|
-
let objArr = col.getAnchoredLayoutObjects();
|
|
3500
|
-
for (let i = 0; i < objArr.length; i++) {
|
|
3501
|
-
let text = objArr[i].getTextContent();
|
|
3502
|
-
if (text && isDynamicsText(text)) {
|
|
3503
|
-
return text;
|
|
3504
|
-
}
|
|
3505
|
-
}
|
|
3506
|
-
}
|
|
3507
|
-
return void 0;
|
|
3508
|
-
}
|
|
3509
|
-
getExtensionRangeInfo() {
|
|
3510
|
-
let { startColumn, length: extensionLength, context } = this;
|
|
3511
|
-
let columnRange = [startColumn];
|
|
3512
|
-
if (extensionLength <= 0) {
|
|
3513
|
-
return { startColumn, endColumn: startColumn, columnRange, extensionBreakText: void 0 };
|
|
3514
|
-
}
|
|
3515
|
-
let ticksLeft = extensionLength;
|
|
3516
|
-
let endColumn = startColumn;
|
|
3517
|
-
while (true) {
|
|
3518
|
-
let nextColumn = endColumn.getNextColumn();
|
|
3519
|
-
if (!nextColumn) {
|
|
3520
|
-
return { startColumn, endColumn, columnRange, extensionBreakText: void 0 };
|
|
3521
|
-
}
|
|
3522
|
-
let extensionBreakText = this.getSpanBreakText(nextColumn, context);
|
|
3523
|
-
if (extensionBreakText !== void 0) {
|
|
3524
|
-
return { startColumn, endColumn, columnRange, extensionBreakText };
|
|
3525
|
-
}
|
|
3526
|
-
ticksLeft -= endColumn.getTicksToNextColumn();
|
|
3527
|
-
if (ticksLeft <= 0) {
|
|
3528
|
-
return { startColumn, endColumn, columnRange, extensionBreakText: void 0 };
|
|
3529
|
-
} else {
|
|
3530
|
-
endColumn = nextColumn;
|
|
3531
|
-
columnRange.push(endColumn);
|
|
3532
|
-
}
|
|
3533
|
-
}
|
|
3534
|
-
}
|
|
3535
|
-
};
|
|
3536
|
-
|
|
3537
3979
|
// src/score/engine/player.ts
|
|
3538
3980
|
var AccelerandoSpeedMul = 2;
|
|
3539
3981
|
var RitardandoSpeedDiv = 2;
|
|
@@ -3573,7 +4015,7 @@ var PlayerColumnProps = class {
|
|
|
3573
4015
|
return this.speed;
|
|
3574
4016
|
}
|
|
3575
4017
|
getTempo() {
|
|
3576
|
-
let speed =
|
|
4018
|
+
let speed = utils_exports.Math.clamp(this.getSpeed(), 0.1, 10);
|
|
3577
4019
|
return alterTempoSpeed(this.measure.getTempo(), speed);
|
|
3578
4020
|
}
|
|
3579
4021
|
setVolume(volume) {
|
|
@@ -3598,7 +4040,7 @@ var PlayerColumnProps = class {
|
|
|
3598
4040
|
if (symbolsTicks.length === 0) {
|
|
3599
4041
|
return 0;
|
|
3600
4042
|
} else {
|
|
3601
|
-
return
|
|
4043
|
+
return utils_exports.Math.sum(symbolsTicks) / symbolsTicks.length;
|
|
3602
4044
|
}
|
|
3603
4045
|
}
|
|
3604
4046
|
}
|
|
@@ -3721,8 +4163,8 @@ var Player = class _Player {
|
|
|
3721
4163
|
}
|
|
3722
4164
|
let curSpeed = 1;
|
|
3723
4165
|
let curVolume = getDefaultVolume();
|
|
3724
|
-
let speedMap = new
|
|
3725
|
-
let volumeMap = new
|
|
4166
|
+
let speedMap = new UniMap();
|
|
4167
|
+
let volumeMap = new UniMap();
|
|
3726
4168
|
const pushSpeed = (col, speed) => speedMap.getOrCreate(col, []).push(speed);
|
|
3727
4169
|
const pushVolume = (col, volume) => volumeMap.getOrCreate(col, []).push(volume);
|
|
3728
4170
|
this.playerColumnSequence.forEach((col) => {
|
|
@@ -3730,8 +4172,7 @@ var Player = class _Player {
|
|
|
3730
4172
|
return;
|
|
3731
4173
|
}
|
|
3732
4174
|
col.getAnchoredLayoutObjects().forEach((layoutObj) => {
|
|
3733
|
-
|
|
3734
|
-
let text = (_a = layoutObj.getTextContent()) != null ? _a : "";
|
|
4175
|
+
const text = getTextContent(layoutObj.musicObj);
|
|
3735
4176
|
let vol;
|
|
3736
4177
|
if (text === "a tempo" /* a_tempo */) {
|
|
3737
4178
|
curSpeed = 1;
|
|
@@ -3739,14 +4180,15 @@ var Player = class _Player {
|
|
|
3739
4180
|
curVolume = vol;
|
|
3740
4181
|
} else if (layoutObj.musicObj.getLink() instanceof Extension) {
|
|
3741
4182
|
let extension = layoutObj.musicObj.getLink();
|
|
3742
|
-
|
|
3743
|
-
|
|
4183
|
+
const range = extension.getRange();
|
|
4184
|
+
const stopText = range.stopObject ? getTextContent(range.stopObject) : "";
|
|
4185
|
+
let totalTicks = utils_exports.Math.sum(range.columnRange.map((c) => c.getTicksToNextColumn()));
|
|
3744
4186
|
switch (text) {
|
|
3745
4187
|
case "accel." /* accel */: {
|
|
3746
4188
|
let startSpeed = curSpeed;
|
|
3747
4189
|
let endSpeed = startSpeed * AccelerandoSpeedMul;
|
|
3748
4190
|
let accuTicks = 0;
|
|
3749
|
-
columnRange.forEach((c) => {
|
|
4191
|
+
range.columnRange.forEach((c) => {
|
|
3750
4192
|
accuTicks += c.getTicksToNextColumn();
|
|
3751
4193
|
pushSpeed(c, startSpeed + (endSpeed - startSpeed) * accuTicks / totalTicks);
|
|
3752
4194
|
});
|
|
@@ -3756,7 +4198,7 @@ var Player = class _Player {
|
|
|
3756
4198
|
let startSpeed = curSpeed;
|
|
3757
4199
|
let endSpeed = startSpeed / RitardandoSpeedDiv;
|
|
3758
4200
|
let accuTicks = 0;
|
|
3759
|
-
columnRange.forEach((c) => {
|
|
4201
|
+
range.columnRange.forEach((c) => {
|
|
3760
4202
|
accuTicks += c.getTicksToNextColumn();
|
|
3761
4203
|
pushSpeed(c, startSpeed + (endSpeed - startSpeed) * accuTicks / totalTicks);
|
|
3762
4204
|
});
|
|
@@ -3765,11 +4207,11 @@ var Player = class _Player {
|
|
|
3765
4207
|
case "cresc." /* cresc */: {
|
|
3766
4208
|
let startVol = curVolume;
|
|
3767
4209
|
let endVol = startVol + CrescendoVolumeAdd;
|
|
3768
|
-
if (
|
|
4210
|
+
if (range.stopObject && (vol = getDynamicsVolume(stopText)) !== void 0 && vol > startVol) {
|
|
3769
4211
|
endVol = vol;
|
|
3770
4212
|
}
|
|
3771
4213
|
let accuTicks = 0;
|
|
3772
|
-
columnRange.forEach((c) => {
|
|
4214
|
+
range.columnRange.forEach((c) => {
|
|
3773
4215
|
accuTicks += c.getTicksToNextColumn();
|
|
3774
4216
|
pushVolume(c, startVol + (endVol - startVol) * accuTicks / totalTicks);
|
|
3775
4217
|
});
|
|
@@ -3779,11 +4221,11 @@ var Player = class _Player {
|
|
|
3779
4221
|
case "dim." /* dim */: {
|
|
3780
4222
|
let startVol = curVolume;
|
|
3781
4223
|
let endVol = startVol - DiminuendoVolumeSub;
|
|
3782
|
-
if (
|
|
4224
|
+
if (range.stopObject && (vol = getDynamicsVolume(stopText)) !== void 0 && vol < startVol) {
|
|
3783
4225
|
endVol = vol;
|
|
3784
4226
|
}
|
|
3785
4227
|
let accuTicks = 0;
|
|
3786
|
-
columnRange.forEach((c) => {
|
|
4228
|
+
range.columnRange.forEach((c) => {
|
|
3787
4229
|
accuTicks += c.getTicksToNextColumn();
|
|
3788
4230
|
pushVolume(c, startVol + (endVol - startVol) * accuTicks / totalTicks);
|
|
3789
4231
|
});
|
|
@@ -3794,11 +4236,11 @@ var Player = class _Player {
|
|
|
3794
4236
|
});
|
|
3795
4237
|
let speedArr = speedMap.getOrDefault(col, []);
|
|
3796
4238
|
if (speedArr.length > 0) {
|
|
3797
|
-
curSpeed =
|
|
4239
|
+
curSpeed = utils_exports.Math.sum(speedArr) / speedArr.length;
|
|
3798
4240
|
}
|
|
3799
4241
|
let volumeArr = volumeMap.getOrDefault(col, []);
|
|
3800
4242
|
if (volumeArr.length > 0) {
|
|
3801
|
-
curVolume =
|
|
4243
|
+
curVolume = utils_exports.Math.sum(volumeArr) / volumeArr.length;
|
|
3802
4244
|
}
|
|
3803
4245
|
col.getPlayerProps().setSpeed(curSpeed);
|
|
3804
4246
|
col.getPlayerProps().setVolume(curVolume);
|
|
@@ -3918,17 +4360,17 @@ var Player = class _Player {
|
|
|
3918
4360
|
let measure = col.measure;
|
|
3919
4361
|
let x = col.getRect().anchorX;
|
|
3920
4362
|
let { top, height } = measure.row.getRect();
|
|
3921
|
-
return new
|
|
4363
|
+
return new Rect(x, top, 0, height);
|
|
3922
4364
|
}
|
|
3923
4365
|
};
|
|
3924
4366
|
|
|
3925
4367
|
// src/score/engine/obj-bar-line.ts
|
|
3926
|
-
import { AnchoredRect as AnchoredRect13, UniMap as UniMap4 } from "@tspro/ts-utils-lib";
|
|
3927
4368
|
var ObjStaffBarLine = class extends MusicObject {
|
|
3928
|
-
constructor(barLine, line) {
|
|
4369
|
+
constructor(barLine, line, rowGroup) {
|
|
3929
4370
|
super(line);
|
|
3930
4371
|
this.barLine = barLine;
|
|
3931
4372
|
this.line = line;
|
|
4373
|
+
this.rowGroup = rowGroup;
|
|
3932
4374
|
__publicField(this, "vlines", []);
|
|
3933
4375
|
__publicField(this, "dots", []);
|
|
3934
4376
|
__publicField(this, "mi");
|
|
@@ -3942,12 +4384,12 @@ var ObjStaffBarLine = class extends MusicObject {
|
|
|
3942
4384
|
return this.getRect().contains(x, y) ? [this] : [];
|
|
3943
4385
|
}
|
|
3944
4386
|
updateRect() {
|
|
3945
|
-
this.rect = new
|
|
4387
|
+
this.rect = new AnchoredRect(0, 0, this.line.getTopLineY(), this.line.getBottomLineY());
|
|
3946
4388
|
this.vlines.forEach(
|
|
3947
|
-
(l) => this.rect.expandInPlace(new
|
|
4389
|
+
(l) => this.rect.expandInPlace(new AnchoredRect(l.left, l.left + l.width, this.rect.top, this.rect.bottom))
|
|
3948
4390
|
);
|
|
3949
4391
|
this.dots.forEach(
|
|
3950
|
-
(d) => this.rect.expandInPlace(new
|
|
4392
|
+
(d) => this.rect.expandInPlace(new AnchoredRect(d.x - d.r, d.x + d.r, d.y - d.r, d.y + d.r))
|
|
3951
4393
|
);
|
|
3952
4394
|
}
|
|
3953
4395
|
offset(dx, dy) {
|
|
@@ -3964,9 +4406,15 @@ var ObjBarLine = class extends MusicObject {
|
|
|
3964
4406
|
super(measure);
|
|
3965
4407
|
this.measure = measure;
|
|
3966
4408
|
__publicField(this, "notationLineObjects", []);
|
|
3967
|
-
__publicField(this, "notationLineObjectsByGrp", new
|
|
4409
|
+
__publicField(this, "notationLineObjectsByGrp", new UniMap());
|
|
3968
4410
|
__publicField(this, "barLineType", 0 /* None */);
|
|
3969
4411
|
}
|
|
4412
|
+
get doc() {
|
|
4413
|
+
return this.measure.doc;
|
|
4414
|
+
}
|
|
4415
|
+
get row() {
|
|
4416
|
+
return this.measure.row;
|
|
4417
|
+
}
|
|
3970
4418
|
pick(x, y) {
|
|
3971
4419
|
if (!this.getRect().contains(x, y)) {
|
|
3972
4420
|
return [];
|
|
@@ -3994,7 +4442,7 @@ var ObjBarLine = class extends MusicObject {
|
|
|
3994
4442
|
this.notationLineObjectsByGrp.clear();
|
|
3995
4443
|
row.getRowGroups().forEach((grp) => {
|
|
3996
4444
|
grp.lines.forEach((line) => {
|
|
3997
|
-
let obj = new ObjStaffBarLine(this, line);
|
|
4445
|
+
let obj = new ObjStaffBarLine(this, line, grp);
|
|
3998
4446
|
this.notationLineObjects.push(obj);
|
|
3999
4447
|
this.notationLineObjectsByGrp.getOrCreate(grp, []).push(obj);
|
|
4000
4448
|
let lineCenterY;
|
|
@@ -4058,7 +4506,7 @@ var ObjBarLine = class extends MusicObject {
|
|
|
4058
4506
|
this.rect.expandInPlace(this.notationLineObjects[i].getRect());
|
|
4059
4507
|
}
|
|
4060
4508
|
} else {
|
|
4061
|
-
this.rect = new
|
|
4509
|
+
this.rect = new AnchoredRect();
|
|
4062
4510
|
}
|
|
4063
4511
|
}
|
|
4064
4512
|
offset(dx, dy) {
|
|
@@ -4069,16 +4517,10 @@ var ObjBarLine = class extends MusicObject {
|
|
|
4069
4517
|
if (this.barLineType === 0 /* None */)
|
|
4070
4518
|
return;
|
|
4071
4519
|
ctx.drawDebugRect(this.getRect());
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
if (i === 0) {
|
|
4077
|
-
let { top, height } = obj.barLine.getRect();
|
|
4078
|
-
obj.vlines.forEach((l) => ctx.fillRect(l.left, top, l.width, height));
|
|
4079
|
-
}
|
|
4080
|
-
});
|
|
4081
|
-
}
|
|
4520
|
+
this.notationLineObjects.forEach((o) => {
|
|
4521
|
+
o.vlines.forEach((l) => o.line.drawVerticalLine(ctx, l.left, l.width));
|
|
4522
|
+
o.dots.forEach((d) => ctx.fillCircle(d.x, d.y, d.r));
|
|
4523
|
+
});
|
|
4082
4524
|
}
|
|
4083
4525
|
};
|
|
4084
4526
|
var ObjBarLineLeft = class extends ObjBarLine {
|
|
@@ -4143,25 +4585,25 @@ var ObjBarLineRight = class extends ObjBarLine {
|
|
|
4143
4585
|
};
|
|
4144
4586
|
|
|
4145
4587
|
// src/score/engine/obj-ending.ts
|
|
4146
|
-
import {
|
|
4147
|
-
import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
|
|
4588
|
+
import { MusicError as MusicError7, MusicErrorType as MusicErrorType7 } from "@tspro/web-music-score/core";
|
|
4148
4589
|
var ObjEnding = class extends MusicObject {
|
|
4149
|
-
constructor(measure, passages) {
|
|
4590
|
+
constructor(measure, color, passages) {
|
|
4150
4591
|
super(measure);
|
|
4151
4592
|
this.measure = measure;
|
|
4593
|
+
this.color = color;
|
|
4152
4594
|
this.passages = passages;
|
|
4153
4595
|
__publicField(this, "endingText");
|
|
4154
4596
|
__publicField(this, "shapeRects", []);
|
|
4155
4597
|
__publicField(this, "mi");
|
|
4156
4598
|
this.mi = new MEnding(this);
|
|
4157
|
-
if (!
|
|
4158
|
-
throw new
|
|
4159
|
-
} else if (!this.passages.every((p) =>
|
|
4160
|
-
throw new
|
|
4599
|
+
if (!guard_exports.isIntegerGte(passages.length, 1)) {
|
|
4600
|
+
throw new MusicError7(MusicErrorType7.Score, "Passages is empty.");
|
|
4601
|
+
} else if (!this.passages.every((p) => guard_exports.isIntegerGte(p, 1))) {
|
|
4602
|
+
throw new MusicError7(MusicErrorType7.Score, "Invalid passages: " + this.passages);
|
|
4161
4603
|
}
|
|
4162
4604
|
this.passages.sort((a, b) => a - b);
|
|
4163
|
-
|
|
4164
|
-
this.endingText = new ObjText(this, text, 0, 1);
|
|
4605
|
+
const text = this.passages.map((p) => p + ".").join("");
|
|
4606
|
+
this.endingText = new ObjText(this, { text, color }, 0, 1);
|
|
4165
4607
|
}
|
|
4166
4608
|
getMusicInterface() {
|
|
4167
4609
|
return this.mi;
|
|
@@ -4184,7 +4626,7 @@ var ObjEnding = class extends MusicObject {
|
|
|
4184
4626
|
return this.rect.contains(x, y) ? [this] : [];
|
|
4185
4627
|
}
|
|
4186
4628
|
layout(ctx) {
|
|
4187
|
-
this.rect = new
|
|
4629
|
+
this.rect = new AnchoredRect();
|
|
4188
4630
|
this.shapeRects = [this.rect.clone()];
|
|
4189
4631
|
}
|
|
4190
4632
|
layoutFitToMeasure(ctx) {
|
|
@@ -4194,13 +4636,13 @@ var ObjEnding = class extends MusicObject {
|
|
|
4194
4636
|
let textRect = this.endingText.getRect();
|
|
4195
4637
|
let measureContent = measure.getColumnsContentRect();
|
|
4196
4638
|
let endingHeight = textRect.height;
|
|
4197
|
-
this.rect = new
|
|
4639
|
+
this.rect = new AnchoredRect(measureContent.left + unitSize, measureContent.right - unitSize, -endingHeight, 0);
|
|
4198
4640
|
this.endingText.setLeft(this.rect.left + unitSize / 2);
|
|
4199
4641
|
this.endingText.setBottom(this.rect.bottom);
|
|
4200
4642
|
this.shapeRects = [
|
|
4201
|
-
new
|
|
4202
|
-
new
|
|
4203
|
-
new
|
|
4643
|
+
new AnchoredRect(this.rect.left, this.rect.left + 1, this.rect.top, this.rect.bottom),
|
|
4644
|
+
new AnchoredRect(this.rect.left, this.rect.right, this.rect.top, this.rect.top + 1),
|
|
4645
|
+
new AnchoredRect(this.rect.right - 1, this.rect.right, this.rect.top, this.rect.bottom),
|
|
4204
4646
|
this.endingText.getRect().clone()
|
|
4205
4647
|
];
|
|
4206
4648
|
}
|
|
@@ -4212,7 +4654,7 @@ var ObjEnding = class extends MusicObject {
|
|
|
4212
4654
|
draw(ctx) {
|
|
4213
4655
|
let { rect } = this;
|
|
4214
4656
|
ctx.drawDebugRect(this.rect);
|
|
4215
|
-
ctx.color(
|
|
4657
|
+
ctx.color(this.color).lineWidth(1);
|
|
4216
4658
|
ctx.beginPath();
|
|
4217
4659
|
ctx.moveTo(rect.left, rect.bottom);
|
|
4218
4660
|
ctx.lineTo(rect.left, rect.top);
|
|
@@ -4226,9 +4668,8 @@ var ObjEnding = class extends MusicObject {
|
|
|
4226
4668
|
};
|
|
4227
4669
|
|
|
4228
4670
|
// src/score/engine/obj-beam-group.ts
|
|
4229
|
-
import { AnchoredRect as AnchoredRect15, Utils as Utils6 } from "@tspro/ts-utils-lib";
|
|
4230
4671
|
import { NoteLength as NoteLength5, Tuplet as Tuplet3, NoteLengthProps as NoteLengthProps4 } from "@tspro/web-music-score/theory";
|
|
4231
|
-
import { MusicError as
|
|
4672
|
+
import { MusicError as MusicError8, MusicErrorType as MusicErrorType8 } from "@tspro/web-music-score/core";
|
|
4232
4673
|
var adjustBeamAngle = (dx, dy) => {
|
|
4233
4674
|
let T = DocumentSettings.BeamAngleFactor;
|
|
4234
4675
|
if (!Number.isFinite(T) || T === 0) {
|
|
@@ -4256,7 +4697,7 @@ var BeamPoint = class {
|
|
|
4256
4697
|
this.beamGroup.requestRectUpdate();
|
|
4257
4698
|
}
|
|
4258
4699
|
getRect() {
|
|
4259
|
-
return new
|
|
4700
|
+
return new AnchoredRect(this.x, this.x, this.x, this.y - this.topBeamsHeight, this.y, this.y + this.bottomBeamsHeight);
|
|
4260
4701
|
}
|
|
4261
4702
|
};
|
|
4262
4703
|
var ObjStaffBeamGroup = class extends MusicObject {
|
|
@@ -4313,9 +4754,9 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
|
|
|
4313
4754
|
this.mi = new MBeamGroup(this);
|
|
4314
4755
|
let beamGroupName = tupletRatio ? "Tuplet" : "BeamGroup";
|
|
4315
4756
|
if (!symbols.every((s) => s.measure === symbols[0].measure)) {
|
|
4316
|
-
throw new
|
|
4757
|
+
throw new MusicError8(MusicErrorType8.Score, `All ${beamGroupName} symbols are not in same measure.`);
|
|
4317
4758
|
} else if (symbols.length < 2) {
|
|
4318
|
-
throw new
|
|
4759
|
+
throw new MusicError8(MusicErrorType8.Score, `${beamGroupName} needs minimum 2 symbols, but ${symbols.length} given.`);
|
|
4319
4760
|
}
|
|
4320
4761
|
if (tupletRatio !== void 0) {
|
|
4321
4762
|
let isGroup = symbols.length < 3 || symbols.some((s) => !(s instanceof ObjNoteGroup)) || symbols.some((s) => s.rhythmProps.flagCount !== symbols[0].rhythmProps.flagCount);
|
|
@@ -4335,7 +4776,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
|
|
|
4335
4776
|
symbols.forEach((s) => s.setBeamGroup(this));
|
|
4336
4777
|
symbols[0].measure.addBeamGroup(this);
|
|
4337
4778
|
} else {
|
|
4338
|
-
throw new
|
|
4779
|
+
throw new MusicError8(MusicErrorType8.Score, `Cannot add ${beamGroupName} because some symbol already has one.`);
|
|
4339
4780
|
}
|
|
4340
4781
|
if (this.type === 0 /* RegularBeam */) {
|
|
4341
4782
|
this.symbols.filter((sym) => sym instanceof ObjNoteGroup).some((sym, i) => {
|
|
@@ -4350,7 +4791,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
|
|
|
4350
4791
|
if (this.type === 0 /* RegularBeam */) {
|
|
4351
4792
|
throw new InvalidBeamGroup(this, "Beam symbols have different voiceId.");
|
|
4352
4793
|
} else {
|
|
4353
|
-
throw new
|
|
4794
|
+
throw new MusicError8(MusicErrorType8.Score, `Tuplet symbols have different voiceId.`);
|
|
4354
4795
|
}
|
|
4355
4796
|
}
|
|
4356
4797
|
symbols[0].row.getStaves().forEach((staff) => {
|
|
@@ -4534,7 +4975,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
|
|
|
4534
4975
|
symbolY.forEach((symY, i) => {
|
|
4535
4976
|
let symX = symbolX[i];
|
|
4536
4977
|
if (symX !== void 0 && symY !== void 0) {
|
|
4537
|
-
let beamY =
|
|
4978
|
+
let beamY = utils_exports.Math.interpolateY(leftX, leftY, rightX, rightY, symX);
|
|
4538
4979
|
let raiseY = symY - beamY;
|
|
4539
4980
|
if (stemDir === "up" /* Up */ && raiseY < 0) {
|
|
4540
4981
|
raiseBeamY = Math.min(raiseBeamY, raiseY);
|
|
@@ -4549,8 +4990,8 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
|
|
|
4549
4990
|
let obj = new ObjStaffBeamGroup(mainStaff, this);
|
|
4550
4991
|
if (type === 2 /* TupletGroup */) {
|
|
4551
4992
|
let ef = unitSize / (rightX - leftX);
|
|
4552
|
-
let l =
|
|
4553
|
-
let r =
|
|
4993
|
+
let l = utils_exports.Math.interpolateCoord(leftX, leftY + groupLineDy, rightX, rightY + groupLineDy, -ef);
|
|
4994
|
+
let r = utils_exports.Math.interpolateCoord(leftX, leftY + groupLineDy, rightX, rightY + groupLineDy, 1 + ef);
|
|
4554
4995
|
obj.points.push(new BeamPoint(leftStaff, this, leftSymbol, l.x, l.y));
|
|
4555
4996
|
obj.points.push(new BeamPoint(rightStaff, this, rightSymbol, r.x, r.y));
|
|
4556
4997
|
obj.tupletNumberOffsetY = 0;
|
|
@@ -4599,7 +5040,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
|
|
|
4599
5040
|
}
|
|
4600
5041
|
updateRect() {
|
|
4601
5042
|
if (this.staffObjects.length === 0) {
|
|
4602
|
-
this.rect = new
|
|
5043
|
+
this.rect = new AnchoredRect();
|
|
4603
5044
|
} else {
|
|
4604
5045
|
this.staffObjects.forEach((obj) => obj.updateRect());
|
|
4605
5046
|
this.rect = this.staffObjects[0].getRect().clone();
|
|
@@ -4616,7 +5057,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
|
|
|
4616
5057
|
obj.points.forEach((pt) => {
|
|
4617
5058
|
if (pt.symbol instanceof ObjNoteGroup) {
|
|
4618
5059
|
if (pt !== left && pt !== right) {
|
|
4619
|
-
pt.y =
|
|
5060
|
+
pt.y = utils_exports.Math.interpolateY(left.x, left.y, right.x, right.y, pt.x);
|
|
4620
5061
|
}
|
|
4621
5062
|
pt.symbol.setStemTipY(pt.staff, pt.y);
|
|
4622
5063
|
}
|
|
@@ -4642,8 +5083,8 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
|
|
|
4642
5083
|
let { x: rx, y: ry } = obj.points[obj.points.length - 1];
|
|
4643
5084
|
if (obj.tupletNumber) {
|
|
4644
5085
|
let tf = obj.tupletNumber.getRect().width / (rx - lx) * 1.2;
|
|
4645
|
-
let lc =
|
|
4646
|
-
let rc =
|
|
5086
|
+
let lc = utils_exports.Math.interpolateCoord(lx, ly, rx, ry, 0.5 - tf / 2);
|
|
5087
|
+
let rc = utils_exports.Math.interpolateCoord(lx, ly, rx, ry, 0.5 + tf / 2);
|
|
4647
5088
|
ctx.strokeLine(lx, ly, lc.x, lc.y);
|
|
4648
5089
|
ctx.strokeLine(rc.x, rc.y, rx, ry);
|
|
4649
5090
|
} else {
|
|
@@ -4757,12 +5198,11 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
|
|
|
4757
5198
|
};
|
|
4758
5199
|
|
|
4759
5200
|
// src/score/engine/obj-fermata.ts
|
|
4760
|
-
import { AnchoredRect as AnchoredRect16 } from "@tspro/ts-utils-lib";
|
|
4761
5201
|
var ObjFermata = class extends MusicObject {
|
|
4762
|
-
constructor(parent, pos) {
|
|
5202
|
+
constructor(parent, pos, color) {
|
|
4763
5203
|
super(parent);
|
|
4764
5204
|
this.pos = pos;
|
|
4765
|
-
|
|
5205
|
+
this.color = color;
|
|
4766
5206
|
__publicField(this, "mi");
|
|
4767
5207
|
this.mi = new MFermata(this);
|
|
4768
5208
|
}
|
|
@@ -4785,7 +5225,7 @@ var ObjFermata = class extends MusicObject {
|
|
|
4785
5225
|
let { unitSize } = ctx;
|
|
4786
5226
|
let width = unitSize * 4;
|
|
4787
5227
|
let height = unitSize * 3;
|
|
4788
|
-
this.rect = new
|
|
5228
|
+
this.rect = new AnchoredRect(-width / 2, width / 2, -height, 0);
|
|
4789
5229
|
}
|
|
4790
5230
|
offset(dx, dy) {
|
|
4791
5231
|
this.rect.offsetInPlace(dx, dy);
|
|
@@ -4800,7 +5240,7 @@ var ObjFermata = class extends MusicObject {
|
|
|
4800
5240
|
let bottom = (upsideDown ? this.rect.top : this.rect.bottom) + dy;
|
|
4801
5241
|
let height = bottom - top;
|
|
4802
5242
|
ctx.drawDebugRect(this.rect);
|
|
4803
|
-
ctx.color(
|
|
5243
|
+
ctx.color(this.color).lineWidth(1);
|
|
4804
5244
|
ctx.beginPath();
|
|
4805
5245
|
ctx.moveTo(left, bottom);
|
|
4806
5246
|
ctx.bezierCurveTo(left, top, right, top, right, bottom);
|
|
@@ -4813,15 +5253,19 @@ var ObjFermata = class extends MusicObject {
|
|
|
4813
5253
|
};
|
|
4814
5254
|
|
|
4815
5255
|
// src/score/engine/obj-extension-line.ts
|
|
4816
|
-
|
|
5256
|
+
function isExtensionStartObject(obj) {
|
|
5257
|
+
return obj instanceof ObjText || obj instanceof ObjSpecialText;
|
|
5258
|
+
}
|
|
5259
|
+
function isExtensionStopObject(obj) {
|
|
5260
|
+
return obj instanceof ObjBarLineRight || obj instanceof ObjText || obj instanceof ObjSpecialText;
|
|
5261
|
+
}
|
|
4817
5262
|
var ObjExtensionLine = class extends MusicObject {
|
|
4818
|
-
constructor(measure, line, extension,
|
|
5263
|
+
constructor(measure, line, extension, cols) {
|
|
4819
5264
|
super(measure);
|
|
4820
5265
|
this.measure = measure;
|
|
4821
5266
|
this.line = line;
|
|
4822
5267
|
this.extension = extension;
|
|
4823
|
-
this.
|
|
4824
|
-
this.rightObj = rightObj;
|
|
5268
|
+
this.cols = cols;
|
|
4825
5269
|
__publicField(this, "mi");
|
|
4826
5270
|
extension.addTail(this);
|
|
4827
5271
|
this.mi = new MExtensionLine(this);
|
|
@@ -4832,52 +5276,61 @@ var ObjExtensionLine = class extends MusicObject {
|
|
|
4832
5276
|
getMusicInterface() {
|
|
4833
5277
|
return this.mi;
|
|
4834
5278
|
}
|
|
4835
|
-
getLineLeft() {
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
5279
|
+
getLineLeft(ctx) {
|
|
5280
|
+
let obj = this.cols[0];
|
|
5281
|
+
if (isExtensionStartObject(obj))
|
|
5282
|
+
return obj.getRect().right + ctx.unitSize;
|
|
5283
|
+
if (obj instanceof ObjBarLineLeft)
|
|
5284
|
+
return obj.getRect().anchorX;
|
|
5285
|
+
if (obj instanceof ObjRhythmColumn) {
|
|
5286
|
+
const mcols = obj.measure.getColumns();
|
|
5287
|
+
if (obj === mcols[0])
|
|
5288
|
+
return obj.measure.getRect().left;
|
|
5289
|
+
}
|
|
5290
|
+
return obj.getRect().right;
|
|
5291
|
+
}
|
|
5292
|
+
getLineRight(ctx) {
|
|
5293
|
+
let obj = this.cols[this.cols.length - 1];
|
|
5294
|
+
if (isExtensionStopObject(obj))
|
|
5295
|
+
return obj.getRect().left - ctx.unitSize;
|
|
5296
|
+
if (obj instanceof ObjRhythmColumn) {
|
|
5297
|
+
const mcols = obj.measure.getColumns();
|
|
5298
|
+
if (obj === mcols[mcols.length - 1])
|
|
5299
|
+
return obj.measure.getRect().right;
|
|
5300
|
+
let next = obj.getNextColumn();
|
|
5301
|
+
if (next && next.measure === obj.measure)
|
|
5302
|
+
return (obj.getRect().right + next.getRect().left) / 2;
|
|
5303
|
+
}
|
|
5304
|
+
return obj.getRect().anchorX;
|
|
4854
5305
|
}
|
|
4855
5306
|
layoutFitToMeasure(ctx) {
|
|
4856
|
-
let
|
|
4857
|
-
let lineLeft = this.getLineLeft();
|
|
4858
|
-
let lineRight = this.getLineRight();
|
|
4859
|
-
|
|
4860
|
-
this.rect = new
|
|
5307
|
+
let recth = ctx.unitSize;
|
|
5308
|
+
let lineLeft = this.getLineLeft(ctx);
|
|
5309
|
+
let lineRight = this.getLineRight(ctx);
|
|
5310
|
+
[lineLeft, lineRight] = [Math.min(lineLeft, lineRight), Math.max(lineLeft, lineRight)];
|
|
5311
|
+
this.rect = new AnchoredRect(lineLeft, lineRight, -recth / 2, recth / 2);
|
|
4861
5312
|
}
|
|
4862
5313
|
pick(x, y) {
|
|
4863
5314
|
return this.rect.contains(x, y) ? [this] : [];
|
|
4864
5315
|
}
|
|
4865
5316
|
layout(ctx) {
|
|
4866
|
-
this.rect = new
|
|
5317
|
+
this.rect = new AnchoredRect();
|
|
4867
5318
|
}
|
|
4868
5319
|
offset(dx, dy) {
|
|
4869
5320
|
this.rect.offsetInPlace(dx, dy);
|
|
4870
5321
|
}
|
|
4871
5322
|
draw(ctx) {
|
|
4872
5323
|
let { rect } = this;
|
|
4873
|
-
|
|
5324
|
+
const head = this.extension.headObj.musicObj;
|
|
5325
|
+
const color = String(head.userData["extension-color"]);
|
|
5326
|
+
if (this.extension.getLineStyle() === "dashed")
|
|
4874
5327
|
ctx.setLineDash([7, 3]);
|
|
4875
|
-
|
|
4876
|
-
ctx.color("black").lineWidth(1);
|
|
5328
|
+
ctx.color(color).lineWidth(1);
|
|
4877
5329
|
ctx.strokeLine(rect.left, rect.anchorY, rect.right, rect.anchorY);
|
|
4878
5330
|
ctx.setLineDash([]);
|
|
4879
5331
|
let tails = this.extension.getTails();
|
|
4880
|
-
|
|
5332
|
+
let last = tails[tails.length - 1];
|
|
5333
|
+
if (this === last && !isExtensionStopObject(this.cols[this.cols.length - 1])) {
|
|
4881
5334
|
let tipH = rect.anchorY > this.line.getRect().anchorY ? -ctx.unitSize : ctx.unitSize;
|
|
4882
5335
|
ctx.strokeLine(rect.right, rect.anchorY, rect.right, rect.anchorY + tipH);
|
|
4883
5336
|
}
|
|
@@ -4885,14 +5338,13 @@ var ObjExtensionLine = class extends MusicObject {
|
|
|
4885
5338
|
};
|
|
4886
5339
|
|
|
4887
5340
|
// src/score/engine/obj-measure.ts
|
|
4888
|
-
import { MusicError as
|
|
5341
|
+
import { MusicError as MusicError11, MusicErrorType as MusicErrorType11 } from "@tspro/web-music-score/core";
|
|
4889
5342
|
|
|
4890
5343
|
// src/score/engine/connective-props.ts
|
|
4891
5344
|
import { Note as Note6 } from "@tspro/web-music-score/theory";
|
|
4892
5345
|
|
|
4893
5346
|
// src/score/engine/obj-connective.ts
|
|
4894
|
-
import {
|
|
4895
|
-
import { MusicError as MusicError11, MusicErrorType as MusicErrorType11 } from "@tspro/web-music-score/core";
|
|
5347
|
+
import { MusicError as MusicError9, MusicErrorType as MusicErrorType9 } from "@tspro/web-music-score/core";
|
|
4896
5348
|
var ObjConnective = class extends MusicObject {
|
|
4897
5349
|
constructor(connectiveProps, line, measure, leftNoteGroup, leftNoteId, ...args) {
|
|
4898
5350
|
var _a;
|
|
@@ -4922,7 +5374,7 @@ var ObjConnective = class extends MusicObject {
|
|
|
4922
5374
|
this.rightNoteGroup = args[0];
|
|
4923
5375
|
this.rightNoteId = args[1];
|
|
4924
5376
|
this.tieType = void 0;
|
|
4925
|
-
} else if (
|
|
5377
|
+
} else if (guard_exports.isEnumValue(args[0], TieType)) {
|
|
4926
5378
|
this.rightNoteGroup = void 0;
|
|
4927
5379
|
this.rightNoteId = void 0;
|
|
4928
5380
|
this.tieType = args[0];
|
|
@@ -4933,6 +5385,9 @@ var ObjConnective = class extends MusicObject {
|
|
|
4933
5385
|
getMusicInterface() {
|
|
4934
5386
|
return this.mi;
|
|
4935
5387
|
}
|
|
5388
|
+
get doc() {
|
|
5389
|
+
return this.measure.doc;
|
|
5390
|
+
}
|
|
4936
5391
|
isInsideMeasure() {
|
|
4937
5392
|
return this.rightNoteGroup === void 0 || this.leftNoteGroup.measure === this.rightNoteGroup.measure;
|
|
4938
5393
|
}
|
|
@@ -4983,7 +5438,7 @@ var ObjConnective = class extends MusicObject {
|
|
|
4983
5438
|
rx = contentRect.right;
|
|
4984
5439
|
ry = leftPos.y + (rightPos.y - leftPos.y) * tLeft / (tLeft + tRight);
|
|
4985
5440
|
} else {
|
|
4986
|
-
throw new
|
|
5441
|
+
throw new MusicError9(MusicErrorType9.Score, "Cannot layout connective object because no valid left and right note groups.");
|
|
4987
5442
|
}
|
|
4988
5443
|
let spanDy = arcDir === "up" ? -1 : 1;
|
|
4989
5444
|
let arcHeight = spanDy * unitSize * Math.log2(rx - lx) / 3;
|
|
@@ -4992,12 +5447,12 @@ var ObjConnective = class extends MusicObject {
|
|
|
4992
5447
|
this.rx = rx;
|
|
4993
5448
|
this.ry = ry;
|
|
4994
5449
|
this.arcHeight = this.connectiveProps.connective === "slide" /* Slide */ ? 0 : arcHeight;
|
|
4995
|
-
let { nx, ny } =
|
|
5450
|
+
let { nx, ny } = utils_exports.Math.calcNormal(lx, ly, rx, ry);
|
|
4996
5451
|
this.cp1x = lx * 0.7 + rx * 0.3 + nx * this.arcHeight;
|
|
4997
5452
|
this.cp1y = ly * 0.7 + ry * 0.3 + ny * this.arcHeight;
|
|
4998
5453
|
this.cp2x = lx * 0.3 + rx * 0.7 + nx * this.arcHeight;
|
|
4999
5454
|
this.cp2y = ly * 0.3 + ry * 0.7 + ny * this.arcHeight;
|
|
5000
|
-
this.rect = new
|
|
5455
|
+
this.rect = new AnchoredRect(
|
|
5001
5456
|
Math.min(this.lx, this.cp1x, this.cp2x, this.rx),
|
|
5002
5457
|
Math.max(this.lx, this.cp1x, this.cp2x, this.rx),
|
|
5003
5458
|
Math.min(this.ly, this.cp1y, this.cp2y, this.ry),
|
|
@@ -5029,7 +5484,10 @@ var ObjConnective = class extends MusicObject {
|
|
|
5029
5484
|
ctx.drawDebugRect(rect);
|
|
5030
5485
|
let t = _lineWidth * 1.5;
|
|
5031
5486
|
let s = _lineWidth * 0.25;
|
|
5032
|
-
ctx.
|
|
5487
|
+
ctx.lineWidth(1);
|
|
5488
|
+
ctx.color(
|
|
5489
|
+
this.line instanceof ObjTab ? DocumentColor.Tab_Connective : DocumentColor.Staff_Connective
|
|
5490
|
+
);
|
|
5033
5491
|
if (this.arcHeight === 0) {
|
|
5034
5492
|
ctx.beginPath();
|
|
5035
5493
|
ctx.moveTo(this.lx, this.ly);
|
|
@@ -5047,8 +5505,7 @@ var ObjConnective = class extends MusicObject {
|
|
|
5047
5505
|
};
|
|
5048
5506
|
|
|
5049
5507
|
// src/score/engine/connective-props.ts
|
|
5050
|
-
import { MusicError as
|
|
5051
|
-
import { Guard as Guard6 } from "@tspro/ts-utils-lib";
|
|
5508
|
+
import { MusicError as MusicError10, MusicErrorType as MusicErrorType10 } from "@tspro/web-music-score/core";
|
|
5052
5509
|
var ConnectiveProps = class {
|
|
5053
5510
|
constructor(connective, span, noteAnchor, startNoteGroup) {
|
|
5054
5511
|
this.connective = connective;
|
|
@@ -5121,7 +5578,7 @@ var ConnectiveProps = class {
|
|
|
5121
5578
|
this.noteGroups[0].row.getNotationLines().forEach((line) => {
|
|
5122
5579
|
this.computeParams(line);
|
|
5123
5580
|
if (connective === "tie" /* Tie */) {
|
|
5124
|
-
if (
|
|
5581
|
+
if (guard_exports.isEnumValue(span, TieType)) {
|
|
5125
5582
|
let leftNoteGroup = this.noteGroups[0];
|
|
5126
5583
|
for (let noteId = 0; noteId < leftNoteGroup.notes.length; noteId++) {
|
|
5127
5584
|
this.createObjConnectiveWithTieType(line, leftNoteGroup, noteId, span);
|
|
@@ -5187,13 +5644,12 @@ var ConnectiveProps = class {
|
|
|
5187
5644
|
addConnective(leftNoteGroup.measure, leftNoteGroup, leftNoteId, rightNoteGroup, rightNoteId);
|
|
5188
5645
|
addConnective(rightNoteGroup.measure, leftNoteGroup, leftNoteId, rightNoteGroup, rightNoteId);
|
|
5189
5646
|
} else {
|
|
5190
|
-
throw new
|
|
5647
|
+
throw new MusicError10(MusicErrorType10.Score, "Cannot create connective because it is jumping measures.");
|
|
5191
5648
|
}
|
|
5192
5649
|
}
|
|
5193
5650
|
};
|
|
5194
5651
|
|
|
5195
5652
|
// src/score/engine/obj-lyrics.ts
|
|
5196
|
-
import { Guard as Guard7 } from "@tspro/ts-utils-lib";
|
|
5197
5653
|
var ObjLyrics = class extends MusicObject {
|
|
5198
5654
|
constructor(col, verse, line, vpos, lyricsLength, lyricsText, lyricsOptions) {
|
|
5199
5655
|
super(col);
|
|
@@ -5209,7 +5665,7 @@ var ObjLyrics = class extends MusicObject {
|
|
|
5209
5665
|
__publicField(this, "mi");
|
|
5210
5666
|
this.rhythmProps = RhythmProps.get(lyricsLength);
|
|
5211
5667
|
let halign = (lyricsOptions == null ? void 0 : lyricsOptions.align) === "left" /* Left */ ? 0 : (lyricsOptions == null ? void 0 : lyricsOptions.align) === "right" /* Right */ ? 1 : 0.5;
|
|
5212
|
-
this.hyphen =
|
|
5668
|
+
this.hyphen = guard_exports.isEnumValue(lyricsOptions == null ? void 0 : lyricsOptions.hyphen, LyricsHyphen) ? lyricsOptions == null ? void 0 : lyricsOptions.hyphen : void 0;
|
|
5213
5669
|
this.text = new ObjText(this, { text: lyricsText, color: this.color, scale: 0.8 }, halign, 0);
|
|
5214
5670
|
this.rect = this.text.getRect().clone();
|
|
5215
5671
|
this.mi = new MLyrics(this);
|
|
@@ -5259,7 +5715,6 @@ var ObjLyrics = class extends MusicObject {
|
|
|
5259
5715
|
};
|
|
5260
5716
|
|
|
5261
5717
|
// src/score/engine/obj-tab-rhythm.ts
|
|
5262
|
-
import { AnchoredRect as AnchoredRect19, UniMap as UniMap5, Utils as Utils8 } from "@tspro/ts-utils-lib";
|
|
5263
5718
|
var ObjTabRhythm = class extends MusicObject {
|
|
5264
5719
|
constructor(measure, tab) {
|
|
5265
5720
|
super(measure);
|
|
@@ -5268,22 +5723,25 @@ var ObjTabRhythm = class extends MusicObject {
|
|
|
5268
5723
|
__publicField(this, "voiceId");
|
|
5269
5724
|
__publicField(this, "mi");
|
|
5270
5725
|
// Keep non-static
|
|
5271
|
-
__publicField(this, "tupletPartsTextObjMap", new
|
|
5726
|
+
__publicField(this, "tupletPartsTextObjMap", new UniMap());
|
|
5272
5727
|
this.voiceId = getVoiceIds().filter((voiceId) => tab.containsVoiceId(voiceId));
|
|
5273
|
-
this.rect = new
|
|
5728
|
+
this.rect = new AnchoredRect();
|
|
5274
5729
|
this.mi = new MTabRhythm(this);
|
|
5275
5730
|
}
|
|
5276
5731
|
getMusicInterface() {
|
|
5277
5732
|
return this.mi;
|
|
5278
5733
|
}
|
|
5734
|
+
get doc() {
|
|
5735
|
+
return this.measure.doc;
|
|
5736
|
+
}
|
|
5279
5737
|
pick(x, y) {
|
|
5280
5738
|
return this.rect.contains(x, y) ? [this] : [];
|
|
5281
5739
|
}
|
|
5282
5740
|
layout(ctx) {
|
|
5283
5741
|
let columns = this.measure.getColumns();
|
|
5284
|
-
let numColsInVoiceId = getVoiceIds().map((voiceId) =>
|
|
5285
|
-
this.voiceId.sort((a, b) =>
|
|
5286
|
-
this.rect = new
|
|
5742
|
+
let numColsInVoiceId = getVoiceIds().map((voiceId) => utils_exports.Math.sum(columns.map((col) => col.getVoiceSymbol(voiceId) ? 1 : 0)));
|
|
5743
|
+
this.voiceId.sort((a, b) => utils_exports.Math.cmp(numColsInVoiceId[a], numColsInVoiceId[b]));
|
|
5744
|
+
this.rect = new AnchoredRect();
|
|
5287
5745
|
}
|
|
5288
5746
|
hasTuplets() {
|
|
5289
5747
|
return this.measure.getBeamGroups().some((beamGroup) => beamGroup.isTuplet());
|
|
@@ -5305,7 +5763,7 @@ var ObjTabRhythm = class extends MusicObject {
|
|
|
5305
5763
|
}
|
|
5306
5764
|
draw(ctx) {
|
|
5307
5765
|
ctx.drawDebugRect(this.rect);
|
|
5308
|
-
ctx.
|
|
5766
|
+
ctx.lineWidth(1);
|
|
5309
5767
|
let { unitSize, fontSize } = ctx;
|
|
5310
5768
|
let flagSize = unitSize;
|
|
5311
5769
|
let dotSpace = unitSize;
|
|
@@ -5327,20 +5785,23 @@ var ObjTabRhythm = class extends MusicObject {
|
|
|
5327
5785
|
let nextSym = symbols[j + 1];
|
|
5328
5786
|
let colX = sym.col.getRect().anchorX;
|
|
5329
5787
|
if (sym instanceof ObjNoteGroup) {
|
|
5788
|
+
ctx.lineWidth(1);
|
|
5789
|
+
ctx.color(DocumentColor.Tab_Note);
|
|
5330
5790
|
if (sym.rhythmProps.noteSize >= 2) {
|
|
5331
5791
|
ctx.lineWidth(sym.rhythmProps.noteSize === 4 ? 2 : 1);
|
|
5332
5792
|
ctx.strokeLine(colX, stemBottom, colX, stemTop);
|
|
5333
5793
|
}
|
|
5334
|
-
ctx.lineWidth(1);
|
|
5335
5794
|
if (symbols.length === 1) {
|
|
5336
5795
|
for (let i = 0; i < sym.rhythmProps.flagCount; i++) {
|
|
5337
|
-
ctx.drawFlag(new
|
|
5796
|
+
ctx.drawFlag(new AnchoredRect(colX, colX + flagSize, stemTop + i * flagSize, stemTop + (i + 2) * flagSize), "up");
|
|
5338
5797
|
}
|
|
5339
5798
|
}
|
|
5340
5799
|
for (let i = 0; i < sym.rhythmProps.dotCount; i++) {
|
|
5341
5800
|
ctx.fillCircle(colX + dotSpace * (i + 1), stemBottom - dotWidth, dotWidth);
|
|
5342
5801
|
}
|
|
5343
5802
|
} else if (sym instanceof ObjRest) {
|
|
5803
|
+
ctx.lineWidth(1);
|
|
5804
|
+
ctx.color(DocumentColor.Tab_Rest);
|
|
5344
5805
|
let cx = colX;
|
|
5345
5806
|
let cy = (stemTop + stemBottom) / 2;
|
|
5346
5807
|
let scale = 0.65;
|
|
@@ -5361,6 +5822,7 @@ var ObjTabRhythm = class extends MusicObject {
|
|
|
5361
5822
|
let leftBeamCount = left.hasTuplet() ? 1 : left instanceof ObjNoteGroup ? left.getRightBeamCount() : 1;
|
|
5362
5823
|
let rightBeamCount = right.hasTuplet() ? 1 : right instanceof ObjNoteGroup ? right.getLeftBeamCount() : 1;
|
|
5363
5824
|
let maxBeamCount = Math.max(leftBeamCount, rightBeamCount);
|
|
5825
|
+
ctx.color(DocumentColor.Tab_Note);
|
|
5364
5826
|
ctx.lineWidth(2);
|
|
5365
5827
|
for (let i = 0; i < maxBeamCount; i++) {
|
|
5366
5828
|
let leftT = rightBeamCount > leftBeamCount && i >= leftBeamCount ? 0.75 : 0;
|
|
@@ -5376,6 +5838,7 @@ var ObjTabRhythm = class extends MusicObject {
|
|
|
5376
5838
|
}
|
|
5377
5839
|
}
|
|
5378
5840
|
if (beamGroup && beamGroup.isTuplet()) {
|
|
5841
|
+
ctx.color(DocumentColor.Tab_Note);
|
|
5379
5842
|
let cx = (symbols[0].col.getRect().anchorX + symbols[symbols.length - 1].col.getRect().anchorX) / 2;
|
|
5380
5843
|
let text = beamGroup.getTupletRatioText();
|
|
5381
5844
|
let textObj = this.tupletPartsTextObjMap.get(text);
|
|
@@ -5398,11 +5861,19 @@ var ObjTabRhythm = class extends MusicObject {
|
|
|
5398
5861
|
};
|
|
5399
5862
|
|
|
5400
5863
|
// src/score/engine/obj-measure.ts
|
|
5864
|
+
function getExtensionAnchorY(linePos) {
|
|
5865
|
+
switch (linePos) {
|
|
5866
|
+
case "bottom":
|
|
5867
|
+
return 0.8;
|
|
5868
|
+
case "middle":
|
|
5869
|
+
return 0.5;
|
|
5870
|
+
}
|
|
5871
|
+
}
|
|
5401
5872
|
function getExtensionTicks(extensionLength) {
|
|
5402
5873
|
if (typeof extensionLength === "string") {
|
|
5403
5874
|
extensionLength = [extensionLength];
|
|
5404
5875
|
}
|
|
5405
|
-
if (
|
|
5876
|
+
if (guard_exports.isArray(extensionLength)) {
|
|
5406
5877
|
let totalTicks = 0;
|
|
5407
5878
|
for (let i = 0; i < extensionLength.length; ) {
|
|
5408
5879
|
let str = extensionLength[i];
|
|
@@ -5433,7 +5904,7 @@ function getVerseLayoutGroupId(verse) {
|
|
|
5433
5904
|
case 3:
|
|
5434
5905
|
return 10 /* LyricsVerse3 */;
|
|
5435
5906
|
default:
|
|
5436
|
-
throw new
|
|
5907
|
+
throw new MusicError11(MusicErrorType11.Unknown, "VerseNumber is not 1, 2 or 3.");
|
|
5437
5908
|
}
|
|
5438
5909
|
}
|
|
5439
5910
|
var MeasureRegions = class {
|
|
@@ -5479,10 +5950,10 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5479
5950
|
__publicField(this, "measureId");
|
|
5480
5951
|
__publicField(this, "regions", new MeasureRegions());
|
|
5481
5952
|
__publicField(this, "needLayout", true);
|
|
5482
|
-
__publicField(this, "voiceSymbols", asMulti(new
|
|
5953
|
+
__publicField(this, "voiceSymbols", asMulti(new IndexArray()));
|
|
5483
5954
|
__publicField(this, "lastAddedRhythmColumn");
|
|
5484
5955
|
__publicField(this, "lastAddedRhythmSymbol");
|
|
5485
|
-
__publicField(this, "
|
|
5956
|
+
__publicField(this, "addExtensionTo", []);
|
|
5486
5957
|
__publicField(this, "layoutObjects", []);
|
|
5487
5958
|
__publicField(this, "postMeasureBreakWidth", 0);
|
|
5488
5959
|
__publicField(this, "passCount", 0);
|
|
@@ -5494,8 +5965,8 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5494
5965
|
__publicField(this, "endRepeatPlayCount", 2);
|
|
5495
5966
|
// play twice.
|
|
5496
5967
|
__publicField(this, "endRepeatPlayCountText");
|
|
5497
|
-
__publicField(this, "staticObjectsCache", new
|
|
5498
|
-
__publicField(this, "lyricsObjectsCache", new
|
|
5968
|
+
__publicField(this, "staticObjectsCache", new UniMap());
|
|
5969
|
+
__publicField(this, "lyricsObjectsCache", new TriMap());
|
|
5499
5970
|
__publicField(this, "mi");
|
|
5500
5971
|
this.mi = new MMeasure(this);
|
|
5501
5972
|
this.prevMeasure = row.doc.getLastMeasure();
|
|
@@ -5536,7 +6007,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5536
6007
|
updateRunningArguments(runningArgs) {
|
|
5537
6008
|
var _a;
|
|
5538
6009
|
runningArgs != null ? runningArgs : runningArgs = [];
|
|
5539
|
-
let numVoices =
|
|
6010
|
+
let numVoices = utils_exports.Math.sum(getVoiceIds().map((voiceId) => this.getVoiceSymbols(voiceId).length > 0 ? 1 : 0));
|
|
5540
6011
|
getVoiceIds().forEach((voiceId) => {
|
|
5541
6012
|
var _a2;
|
|
5542
6013
|
const getDefaultDiatonicId = () => {
|
|
@@ -5674,6 +6145,12 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5674
6145
|
isLastMeasure() {
|
|
5675
6146
|
return this.nextMeasure === void 0;
|
|
5676
6147
|
}
|
|
6148
|
+
isFirstMeasureInRow() {
|
|
6149
|
+
return this === this.row.getFirstMeasure();
|
|
6150
|
+
}
|
|
6151
|
+
isLastMeasureInRow() {
|
|
6152
|
+
return this === this.row.getLastMeasure();
|
|
6153
|
+
}
|
|
5677
6154
|
getNextMeasure() {
|
|
5678
6155
|
return this.nextMeasure;
|
|
5679
6156
|
}
|
|
@@ -5695,7 +6172,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5695
6172
|
this.alterKeySignature = args[0];
|
|
5696
6173
|
} else if (args[0] instanceof Scale) {
|
|
5697
6174
|
this.alterKeySignature = args[0];
|
|
5698
|
-
} else if (
|
|
6175
|
+
} else if (guard_exports.isNonEmptyString(args[0])) {
|
|
5699
6176
|
if (args.length === 1) {
|
|
5700
6177
|
this.alterKeySignature = getScale(args[0]);
|
|
5701
6178
|
} else if (args.length === 2) {
|
|
@@ -5704,7 +6181,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5704
6181
|
let scaleType = validateScaleType("" + args[1]);
|
|
5705
6182
|
this.alterKeySignature = getScale(tonic, scaleType);
|
|
5706
6183
|
} catch (e) {
|
|
5707
|
-
throw new
|
|
6184
|
+
throw new MusicError11(MusicErrorType11.Score, "Cannot set key signature because invalid args: " + args);
|
|
5708
6185
|
}
|
|
5709
6186
|
}
|
|
5710
6187
|
}
|
|
@@ -5788,9 +6265,11 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5788
6265
|
return this.postMeasureBreakWidth;
|
|
5789
6266
|
}
|
|
5790
6267
|
addLayoutObject(musicObj, line, layoutGroupId, verticalPos) {
|
|
5791
|
-
|
|
6268
|
+
const layoutObj = new LayoutObjectWrapper(musicObj, line, layoutGroupId, verticalPos);
|
|
6269
|
+
this.layoutObjects.push(layoutObj);
|
|
5792
6270
|
this.requestLayout();
|
|
5793
6271
|
this.requestRectUpdate();
|
|
6272
|
+
return layoutObj;
|
|
5794
6273
|
}
|
|
5795
6274
|
forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, addFn) {
|
|
5796
6275
|
const lines = this.row.getNotationLines();
|
|
@@ -5806,7 +6285,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5806
6285
|
let grp = this.doc.getStaffGroup(staffTabOrGroup);
|
|
5807
6286
|
if (grp && !prevGroups.includes(staffTabOrGroup)) {
|
|
5808
6287
|
let curGroups = [...prevGroups, staffTabOrGroup];
|
|
5809
|
-
(
|
|
6288
|
+
(guard_exports.isArray(grp.staffsTabsAndGroups) ? grp.staffsTabsAndGroups : [grp.staffsTabsAndGroups]).forEach((staffTabOrGroup2) => {
|
|
5810
6289
|
switch (grp.verticalPosition) {
|
|
5811
6290
|
case "above" /* Above */:
|
|
5812
6291
|
addToStaffTabOrGroup(staffTabOrGroup2, 0 /* Above */, curGroups);
|
|
@@ -5833,7 +6312,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5833
6312
|
} else {
|
|
5834
6313
|
addToStaffTabOrGroup(0, defaultVerticalPos);
|
|
5835
6314
|
}
|
|
5836
|
-
} else if (
|
|
6315
|
+
} else if (guard_exports.isArray(staffTabOrGroups)) {
|
|
5837
6316
|
staffTabOrGroups.forEach((staffTabOrGroup) => addToStaffTabOrGroup(staffTabOrGroup, defaultVerticalPos));
|
|
5838
6317
|
} else {
|
|
5839
6318
|
addToStaffTabOrGroup(staffTabOrGroups, defaultVerticalPos);
|
|
@@ -5842,10 +6321,11 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5842
6321
|
addFermata(staffTabOrGroups, fermata) {
|
|
5843
6322
|
let anchor = fermata === "atMeasureEnd" /* AtMeasureEnd */ ? this.barLineRight : this.lastAddedRhythmColumn;
|
|
5844
6323
|
if (!anchor) {
|
|
5845
|
-
throw new
|
|
6324
|
+
throw new MusicError11(MusicErrorType11.Score, "Cannot add Fermata because anchor is undefined.");
|
|
5846
6325
|
}
|
|
5847
6326
|
this.forEachStaffGroup(staffTabOrGroups, 0 /* Above */, (line, vpos) => {
|
|
5848
|
-
|
|
6327
|
+
const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Fermata : DocumentColor.Tab_Element_Fermata;
|
|
6328
|
+
this.addLayoutObject(new ObjFermata(anchor, vpos, color), line, 1 /* Fermata */, vpos);
|
|
5849
6329
|
});
|
|
5850
6330
|
this.disableExtension();
|
|
5851
6331
|
this.requestLayout();
|
|
@@ -5858,12 +6338,15 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5858
6338
|
switch (navigation) {
|
|
5859
6339
|
case "ending" /* Ending */:
|
|
5860
6340
|
if (this.navigationSet.has(navigation)) {
|
|
5861
|
-
throw new
|
|
6341
|
+
throw new MusicError11(MusicErrorType11.Score, "Cannot add ending beasure measure already has one.");
|
|
5862
6342
|
}
|
|
5863
6343
|
let anchor = this;
|
|
5864
6344
|
let passages = args;
|
|
5865
6345
|
addLayoutObjectProps = {
|
|
5866
|
-
createObj: () =>
|
|
6346
|
+
createObj: (line) => {
|
|
6347
|
+
const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
|
|
6348
|
+
return new ObjEnding(anchor, color, passages);
|
|
6349
|
+
},
|
|
5867
6350
|
layoutGroupId: 4 /* Ending */,
|
|
5868
6351
|
defaultVerticalPos: 0 /* Above */
|
|
5869
6352
|
};
|
|
@@ -5875,7 +6358,10 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5875
6358
|
let anchor2 = this.barLineRight;
|
|
5876
6359
|
let text = getNavigationString(navigation);
|
|
5877
6360
|
addLayoutObjectProps = {
|
|
5878
|
-
createObj: () =>
|
|
6361
|
+
createObj: (line) => {
|
|
6362
|
+
const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
|
|
6363
|
+
return new ObjText(anchor2, { text, color }, 1, 1);
|
|
6364
|
+
},
|
|
5879
6365
|
layoutGroupId: 3 /* Navigation */,
|
|
5880
6366
|
defaultVerticalPos: 0 /* Above */
|
|
5881
6367
|
};
|
|
@@ -5887,7 +6373,10 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5887
6373
|
let anchor2 = this.barLineRight;
|
|
5888
6374
|
let text = getNavigationString(navigation);
|
|
5889
6375
|
addLayoutObjectProps = {
|
|
5890
|
-
createObj: () =>
|
|
6376
|
+
createObj: (line) => {
|
|
6377
|
+
const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
|
|
6378
|
+
return new ObjText(anchor2, { text, color }, 1, 1);
|
|
6379
|
+
},
|
|
5891
6380
|
layoutGroupId: 3 /* Navigation */,
|
|
5892
6381
|
defaultVerticalPos: 0 /* Above */
|
|
5893
6382
|
};
|
|
@@ -5898,7 +6387,10 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5898
6387
|
let anchor2 = this.barLineLeft;
|
|
5899
6388
|
let text = getNavigationString(navigation);
|
|
5900
6389
|
addLayoutObjectProps = {
|
|
5901
|
-
createObj: () =>
|
|
6390
|
+
createObj: (line) => {
|
|
6391
|
+
const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
|
|
6392
|
+
return new ObjSpecialText(anchor2, text, color);
|
|
6393
|
+
},
|
|
5902
6394
|
layoutGroupId: 3 /* Navigation */,
|
|
5903
6395
|
defaultVerticalPos: 0 /* Above */
|
|
5904
6396
|
};
|
|
@@ -5908,7 +6400,10 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5908
6400
|
let anchor2 = this.barLineRight;
|
|
5909
6401
|
let text = getNavigationString(navigation);
|
|
5910
6402
|
addLayoutObjectProps = {
|
|
5911
|
-
createObj: () =>
|
|
6403
|
+
createObj: (line) => {
|
|
6404
|
+
const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Navigation : DocumentColor.Tab_Element_Navigation;
|
|
6405
|
+
return new ObjSpecialText(anchor2, text, color);
|
|
6406
|
+
},
|
|
5912
6407
|
layoutGroupId: 3 /* Navigation */,
|
|
5913
6408
|
defaultVerticalPos: 0 /* Above */
|
|
5914
6409
|
};
|
|
@@ -5917,15 +6412,17 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5917
6412
|
case "endRepeat" /* EndRepeat */:
|
|
5918
6413
|
if (args.length === 0) {
|
|
5919
6414
|
this.endRepeatPlayCount = 2;
|
|
5920
|
-
} else if (
|
|
6415
|
+
} else if (guard_exports.isIntegerGte(args[0], 2)) {
|
|
5921
6416
|
this.endRepeatPlayCount = args[0];
|
|
5922
6417
|
} else {
|
|
5923
|
-
throw new
|
|
6418
|
+
throw new MusicError11(MusicErrorType11.Score, "Invalid end repeat play count (should be 2 or greater integer): " + args[0]);
|
|
5924
6419
|
}
|
|
5925
6420
|
if (this.endRepeatPlayCount !== 2) {
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
6421
|
+
const text = `${this.endRepeatPlayCount}x`;
|
|
6422
|
+
const textProps = {
|
|
6423
|
+
text,
|
|
6424
|
+
scale: 0.8,
|
|
6425
|
+
color: DocumentColor.Staff_Frame
|
|
5929
6426
|
};
|
|
5930
6427
|
this.endRepeatPlayCountText = new ObjText(this, textProps, 0.5, 1);
|
|
5931
6428
|
}
|
|
@@ -5933,7 +6430,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5933
6430
|
}
|
|
5934
6431
|
if (addLayoutObjectProps) {
|
|
5935
6432
|
this.forEachStaffGroup(staffTabOrGroups, addLayoutObjectProps.defaultVerticalPos, (line, vpos) => {
|
|
5936
|
-
this.addLayoutObject(addLayoutObjectProps.createObj(), line, addLayoutObjectProps.layoutGroupId, vpos);
|
|
6433
|
+
this.addLayoutObject(addLayoutObjectProps.createObj(line), line, addLayoutObjectProps.layoutGroupId, vpos);
|
|
5937
6434
|
});
|
|
5938
6435
|
}
|
|
5939
6436
|
this.navigationSet.add(navigation);
|
|
@@ -5945,38 +6442,45 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5945
6442
|
addAnnotation(staffTabOrGroups, annotation, text) {
|
|
5946
6443
|
let anchor = this.lastAddedRhythmColumn;
|
|
5947
6444
|
if (!anchor) {
|
|
5948
|
-
throw new
|
|
6445
|
+
throw new MusicError11(MusicErrorType11.Score, "Cannot add annotation because anchor is undefined.");
|
|
5949
6446
|
} else if (text.length === 0) {
|
|
5950
|
-
throw new
|
|
6447
|
+
throw new MusicError11(MusicErrorType11.Score, "Cannot add annotation because annotation text is empty.");
|
|
5951
6448
|
}
|
|
5952
6449
|
let textProps = { text };
|
|
5953
6450
|
let layoutGroupId;
|
|
5954
6451
|
let defaultVerticalPos;
|
|
6452
|
+
let linePos;
|
|
5955
6453
|
switch (annotation) {
|
|
5956
6454
|
case "dynamics" /* Dynamics */:
|
|
5957
6455
|
layoutGroupId = 6 /* DynamicsAnnotation */;
|
|
5958
6456
|
defaultVerticalPos = 0 /* Above */;
|
|
5959
6457
|
textProps.italic = true;
|
|
6458
|
+
linePos = "bottom";
|
|
5960
6459
|
break;
|
|
5961
6460
|
case "tempo" /* Tempo */:
|
|
5962
6461
|
layoutGroupId = 5 /* TempoAnnotation */;
|
|
5963
6462
|
defaultVerticalPos = 0 /* Above */;
|
|
5964
6463
|
textProps.italic = true;
|
|
6464
|
+
linePos = "bottom";
|
|
5965
6465
|
break;
|
|
5966
6466
|
}
|
|
6467
|
+
const anchorX = 0.5;
|
|
6468
|
+
const anchorY = getExtensionAnchorY(linePos);
|
|
5967
6469
|
this.disableExtension();
|
|
5968
6470
|
this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
6471
|
+
const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Annotation : DocumentColor.Tab_Element_Annotation;
|
|
6472
|
+
textProps.color = color;
|
|
6473
|
+
let textObj = new ObjText(anchor, textProps, anchorX, anchorY);
|
|
6474
|
+
const layoutObj = this.addLayoutObject(textObj, line, layoutGroupId, vpos);
|
|
6475
|
+
this.enableExtension(layoutObj, color);
|
|
5972
6476
|
});
|
|
5973
6477
|
}
|
|
5974
6478
|
addLabel(staffTabOrGroups, label, text) {
|
|
5975
6479
|
let anchor = this.lastAddedRhythmColumn;
|
|
5976
6480
|
if (!anchor) {
|
|
5977
|
-
throw new
|
|
6481
|
+
throw new MusicError11(MusicErrorType11.Score, "Cannot add label because anchor is undefined.");
|
|
5978
6482
|
} else if (text.length === 0) {
|
|
5979
|
-
throw new
|
|
6483
|
+
throw new MusicError11(MusicErrorType11.Score, "Cannot add label because label text is empty.");
|
|
5980
6484
|
}
|
|
5981
6485
|
let textProps = { text };
|
|
5982
6486
|
let layoutGroupId;
|
|
@@ -5993,52 +6497,57 @@ var ObjMeasure = class extends MusicObject {
|
|
|
5993
6497
|
}
|
|
5994
6498
|
this.disableExtension();
|
|
5995
6499
|
this.forEachStaffGroup(staffTabOrGroups, defaultVerticalPos, (line, vpos) => {
|
|
6500
|
+
const color = line instanceof ObjTab ? DocumentColor.Staff_Element_Label : DocumentColor.Tab_Element_Label;
|
|
6501
|
+
textProps.color = color;
|
|
5996
6502
|
let textObj = new ObjText(anchor, textProps, 0.5, 1);
|
|
5997
|
-
this.addLayoutObject(textObj, line, layoutGroupId, vpos);
|
|
5998
|
-
this.enableExtension(
|
|
6503
|
+
const layoutObj = this.addLayoutObject(textObj, line, layoutGroupId, vpos);
|
|
6504
|
+
this.enableExtension(layoutObj, color);
|
|
5999
6505
|
});
|
|
6000
6506
|
}
|
|
6001
6507
|
addConnective(connective, ...args) {
|
|
6002
6508
|
let anchor = this.lastAddedRhythmSymbol;
|
|
6003
6509
|
if (!(anchor instanceof ObjNoteGroup)) {
|
|
6004
|
-
throw new
|
|
6510
|
+
throw new MusicError11(MusicErrorType11.Score, "Connective can be added to note group only.");
|
|
6005
6511
|
}
|
|
6006
6512
|
if (connective === "tie" /* Tie */) {
|
|
6007
|
-
let tieSpan =
|
|
6008
|
-
let noteAnchor =
|
|
6513
|
+
let tieSpan = guard_exports.isInteger(args[0]) || guard_exports.isEnumValue(args[0], TieType) ? args[0] : 2;
|
|
6514
|
+
let noteAnchor = guard_exports.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
|
|
6009
6515
|
anchor.startConnective(new ConnectiveProps("tie" /* Tie */, tieSpan, noteAnchor, anchor));
|
|
6010
6516
|
} else if (connective === "slur" /* Slur */) {
|
|
6011
|
-
let slurSpan =
|
|
6012
|
-
let noteAnchor =
|
|
6517
|
+
let slurSpan = guard_exports.isInteger(args[0]) ? args[0] : 2;
|
|
6518
|
+
let noteAnchor = guard_exports.isEnumValue(args[1], NoteAnchor) ? args[1] : "auto" /* Auto */;
|
|
6013
6519
|
anchor.startConnective(new ConnectiveProps("slur" /* Slur */, slurSpan, noteAnchor, anchor));
|
|
6014
6520
|
} else if (connective === "slide" /* Slide */) {
|
|
6015
|
-
let noteAnchor =
|
|
6521
|
+
let noteAnchor = guard_exports.isEnumValue(args[0], NoteAnchor) ? args[0] : "auto" /* Auto */;
|
|
6016
6522
|
anchor.startConnective(new ConnectiveProps("slide" /* Slide */, 2, noteAnchor, anchor));
|
|
6017
6523
|
}
|
|
6018
6524
|
}
|
|
6019
6525
|
addExtension(extensionLength, extensionVisible) {
|
|
6020
|
-
this.
|
|
6021
|
-
|
|
6526
|
+
this.addExtensionTo.forEach((data) => {
|
|
6527
|
+
const { layoutObj, color } = data;
|
|
6528
|
+
const { musicObj } = layoutObj;
|
|
6529
|
+
musicObj.userData["extension-color"] = color;
|
|
6530
|
+
const anchor = musicObj.getParent();
|
|
6022
6531
|
if (musicObj instanceof ObjText && anchor instanceof ObjRhythmColumn) {
|
|
6023
6532
|
let lineStyle = "dashed";
|
|
6024
6533
|
let linePos = "bottom";
|
|
6025
|
-
let extension = new Extension(
|
|
6534
|
+
let extension = new Extension(layoutObj, anchor, getExtensionTicks(extensionLength), extensionVisible, lineStyle, linePos);
|
|
6026
6535
|
musicObj.setLink(extension);
|
|
6027
6536
|
} else {
|
|
6028
|
-
throw new
|
|
6537
|
+
throw new MusicError11(MusicErrorType11.Score, "Cannot add extension becaue no compatible music object to attach it to.");
|
|
6029
6538
|
}
|
|
6030
6539
|
});
|
|
6031
|
-
if (this.
|
|
6032
|
-
throw new
|
|
6540
|
+
if (this.addExtensionTo.length === 0) {
|
|
6541
|
+
throw new MusicError11(MusicErrorType11.Score, "Cannot add extension because music object to attach it to is undefined.");
|
|
6033
6542
|
}
|
|
6034
6543
|
this.disableExtension();
|
|
6035
6544
|
this.requestLayout();
|
|
6036
6545
|
}
|
|
6037
|
-
enableExtension(
|
|
6038
|
-
this.
|
|
6546
|
+
enableExtension(layoutObj, color) {
|
|
6547
|
+
this.addExtensionTo.push({ layoutObj, color });
|
|
6039
6548
|
}
|
|
6040
6549
|
disableExtension() {
|
|
6041
|
-
this.
|
|
6550
|
+
this.addExtensionTo = [];
|
|
6042
6551
|
}
|
|
6043
6552
|
getEnding() {
|
|
6044
6553
|
return this.layoutObjects.map((layoutObj) => layoutObj.musicObj).find((musicObj) => musicObj instanceof ObjEnding);
|
|
@@ -6098,7 +6607,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6098
6607
|
col.addLyricsObject(lyricsObj);
|
|
6099
6608
|
let lyricsArr = this.lyricsObjectsCache.getOrCreate(line, vpos, verse, []);
|
|
6100
6609
|
lyricsArr.push(lyricsObj);
|
|
6101
|
-
lyricsArr.sort((a, b) =>
|
|
6610
|
+
lyricsArr.sort((a, b) => utils_exports.Math.cmp(a.col.positionTicks, b.col.positionTicks));
|
|
6102
6611
|
(_a = lyricsObj.measure.getPrevLyricsObject(lyricsObj)) == null ? void 0 : _a.setNextLyricsObject(lyricsObj);
|
|
6103
6612
|
this.addLayoutObject(lyricsObj, line, getVerseLayoutGroupId(verse), vpos);
|
|
6104
6613
|
this.lastAddedRhythmColumn = col;
|
|
@@ -6128,7 +6637,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6128
6637
|
return col2;
|
|
6129
6638
|
}
|
|
6130
6639
|
}
|
|
6131
|
-
throw new
|
|
6640
|
+
throw new MusicError11(MusicErrorType11.Score, "Error in rhythm column. Should never get here.");
|
|
6132
6641
|
}
|
|
6133
6642
|
getMeasureTicks() {
|
|
6134
6643
|
return this.getTimeSignature().measureTicks;
|
|
@@ -6147,7 +6656,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6147
6656
|
}
|
|
6148
6657
|
// Get content rect excluding signature
|
|
6149
6658
|
getColumnsContentRect() {
|
|
6150
|
-
return new
|
|
6659
|
+
return new AnchoredRect(
|
|
6151
6660
|
this.barLineLeft.getRect().anchorX,
|
|
6152
6661
|
this.barLineRight.getRect().anchorX,
|
|
6153
6662
|
this.getRect().top,
|
|
@@ -6230,24 +6739,35 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6230
6739
|
}
|
|
6231
6740
|
createExtensions() {
|
|
6232
6741
|
this.layoutObjects.forEach((layoutObj) => {
|
|
6233
|
-
var _a;
|
|
6234
6742
|
let { musicObj, measure, layoutGroupId, verticalPos, line } = layoutObj;
|
|
6235
6743
|
if (musicObj.getLink() instanceof Extension) {
|
|
6236
6744
|
let extension = musicObj.getLink();
|
|
6237
|
-
if (extension.getHead()
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6745
|
+
if (extension.getHead() !== musicObj)
|
|
6746
|
+
return;
|
|
6747
|
+
extension.getTails().forEach((musicObj2) => measure.removeLayoutObjects(musicObj2));
|
|
6748
|
+
if (!extension.isVisible())
|
|
6749
|
+
return;
|
|
6750
|
+
const range = extension.getRange();
|
|
6751
|
+
const rcols = range.columnRange.slice();
|
|
6752
|
+
for (let isFirst = true; rcols.length > 1; isFirst = false) {
|
|
6753
|
+
const { measure: measure2 } = rcols[0];
|
|
6754
|
+
const i = rcols.findIndex((col) => col.measure !== measure2);
|
|
6755
|
+
const mcols = rcols.splice(0, i > 0 ? i : rcols.length);
|
|
6756
|
+
if (mcols.length < 2) continue;
|
|
6757
|
+
const lineMatch = measure2.row.findMatchingLine(line);
|
|
6758
|
+
if (!lineMatch) continue;
|
|
6759
|
+
const isLast = rcols.length === 0;
|
|
6760
|
+
const extCols = [
|
|
6761
|
+
...isFirst ? [musicObj] : [],
|
|
6762
|
+
...mcols,
|
|
6763
|
+
...isLast && range.stopObject ? [range.stopObject] : []
|
|
6764
|
+
];
|
|
6765
|
+
measure2.addLayoutObject(
|
|
6766
|
+
new ObjExtensionLine(measure2, lineMatch, extension, extCols),
|
|
6767
|
+
lineMatch,
|
|
6768
|
+
layoutGroupId,
|
|
6769
|
+
verticalPos
|
|
6770
|
+
);
|
|
6251
6771
|
}
|
|
6252
6772
|
}
|
|
6253
6773
|
});
|
|
@@ -6301,7 +6821,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6301
6821
|
let beamGroupSize = ts.beamGroupSizes[groupId];
|
|
6302
6822
|
let beamGroupSizeList = [beamGroupSize];
|
|
6303
6823
|
if (beamGroupSize.length > 1) {
|
|
6304
|
-
beamGroupSizeList.unshift([
|
|
6824
|
+
beamGroupSizeList.unshift([utils_exports.Math.sum(beamGroupSize)]);
|
|
6305
6825
|
}
|
|
6306
6826
|
let beamCreated = false;
|
|
6307
6827
|
let groupStartTicksSave = groupStartTicks;
|
|
@@ -6316,7 +6836,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6316
6836
|
let symbolEndTicks = symbolStartTicks + symbol.rhythmProps.ticks;
|
|
6317
6837
|
return symbolStartTicks >= groupStartTicks && symbolEndTicks <= groupEndTicks;
|
|
6318
6838
|
});
|
|
6319
|
-
let groupSymbolsTicks =
|
|
6839
|
+
let groupSymbolsTicks = utils_exports.Math.sum(groupSymbols.map((sym) => sym.rhythmProps.ticks));
|
|
6320
6840
|
if (groupSymbolsTicks === beamGroupTicks && groupSymbols.every((n) => n instanceof ObjNoteGroup) && (groupSymbols.every((n) => n.rhythmProps.flagCount === 1) || beamGroupSizeList.length === 0)) {
|
|
6321
6841
|
if (ObjBeamGroup.createBeam(groupSymbols)) {
|
|
6322
6842
|
beamCreated = true;
|
|
@@ -6347,7 +6867,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6347
6867
|
this.completeRests(getVoiceIds().filter((id) => this.getConsumedTicks(id) > 0));
|
|
6348
6868
|
}
|
|
6349
6869
|
return;
|
|
6350
|
-
} else if (
|
|
6870
|
+
} else if (guard_exports.isArray(voiceId)) {
|
|
6351
6871
|
voiceId.forEach((id) => this.completeRests(id));
|
|
6352
6872
|
return;
|
|
6353
6873
|
} else {
|
|
@@ -6386,7 +6906,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6386
6906
|
this.requestRectUpdate();
|
|
6387
6907
|
let { unitSize } = ctx;
|
|
6388
6908
|
this.postMeasureBreakWidth = this.hasPostMeasureBreak() ? DocumentSettings.PostMeasureBreakWidth * unitSize : 0;
|
|
6389
|
-
let isFirstMeasureInRow = this
|
|
6909
|
+
let isFirstMeasureInRow = this.isFirstMeasureInRow();
|
|
6390
6910
|
let isAfterMeasureBreak = ((_a = this.getPrevMeasure()) == null ? void 0 : _a.hasPostMeasureBreak()) === true;
|
|
6391
6911
|
this.regions.tabTuning_0 = isFirstMeasureInRow && this.row.hasTab ? unitSize * 4 : 0;
|
|
6392
6912
|
let showClef = isFirstMeasureInRow || isAfterMeasureBreak;
|
|
@@ -6419,11 +6939,12 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6419
6939
|
}
|
|
6420
6940
|
});
|
|
6421
6941
|
this.tabStringNotes.length = 0;
|
|
6422
|
-
if (this
|
|
6942
|
+
if (this.isFirstMeasureInRow()) {
|
|
6423
6943
|
this.row.getTabs().forEach((tab) => {
|
|
6424
6944
|
for (let stringId = 0; stringId < 6; stringId++) {
|
|
6425
6945
|
let note = tab.getTuningStrings()[stringId].format(PitchNotation.Helmholtz, SymbolSet.Unicode);
|
|
6426
|
-
let
|
|
6946
|
+
let color = DocumentColor.Tab_Tuning;
|
|
6947
|
+
let obj = new ObjText(this, { text: note, scale: 0.8, color }, 1, 0.5);
|
|
6427
6948
|
obj.layout(ctx);
|
|
6428
6949
|
obj.setRight(this.regions.tabTuning_0 * 0.8);
|
|
6429
6950
|
obj.setCenterY(tab.getStringY(stringId));
|
|
@@ -6456,7 +6977,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6456
6977
|
return;
|
|
6457
6978
|
}
|
|
6458
6979
|
width = Math.max(width, this.getMinWidth());
|
|
6459
|
-
this.rect = new
|
|
6980
|
+
this.rect = new AnchoredRect();
|
|
6460
6981
|
this.rect.anchorX = this.rect.left + width / 2;
|
|
6461
6982
|
this.rect.right = this.rect.left + width;
|
|
6462
6983
|
this.signatures.forEach((signature) => {
|
|
@@ -6541,7 +7062,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6541
7062
|
...this.beamGroups.filter((b) => !b.isEmpty()).map((b) => b.getRect().bottom),
|
|
6542
7063
|
...this.layoutObjects.filter((o) => o.isPositionResolved()).map((o) => o.musicObj.getRect().bottom)
|
|
6543
7064
|
);
|
|
6544
|
-
if (this
|
|
7065
|
+
if (this.isLastMeasureInRow()) {
|
|
6545
7066
|
this.rect.right = Math.max(
|
|
6546
7067
|
this.rect.right,
|
|
6547
7068
|
...this.layoutObjects.filter((o) => o.isPositionResolved() && o.musicObj instanceof ObjFermata).map((o) => o.musicObj.getRect().right)
|
|
@@ -6569,21 +7090,31 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6569
7090
|
}
|
|
6570
7091
|
draw(ctx) {
|
|
6571
7092
|
ctx.drawDebugRect(this.getRect());
|
|
7093
|
+
ctx.lineWidth(1);
|
|
6572
7094
|
let left = this.getStaffLineLeft();
|
|
6573
7095
|
let right = this.getStaffLineRight();
|
|
6574
|
-
ctx.color(
|
|
6575
|
-
const drawLine = (y) => ctx.strokeLine(left, y, right, y);
|
|
7096
|
+
const drawLine = (y, color) => ctx.color(color).strokeLine(left, y, right, y);
|
|
6576
7097
|
this.row.getNotationLines().forEach((line) => {
|
|
6577
7098
|
if (line instanceof ObjStaff) {
|
|
6578
7099
|
for (let p = line.bottomLineDiatonicId; p <= line.topLineDiatonicId; p += 2) {
|
|
6579
|
-
drawLine(line.getDiatonicIdY(p));
|
|
7100
|
+
drawLine(line.getDiatonicIdY(p), DocumentColor.Staff_Frame);
|
|
6580
7101
|
}
|
|
6581
7102
|
} else if (line instanceof ObjTab) {
|
|
6582
7103
|
for (let stringId = 0; stringId < 6; stringId++) {
|
|
6583
|
-
drawLine(line.getStringY(stringId));
|
|
7104
|
+
drawLine(line.getStringY(stringId), DocumentColor.Tab_Frame);
|
|
6584
7105
|
}
|
|
6585
7106
|
}
|
|
6586
7107
|
});
|
|
7108
|
+
if (this.isFirstMeasureInRow() && this.row.getNotationLines().length === 1) {
|
|
7109
|
+
this.row.getTabs().forEach((tab) => {
|
|
7110
|
+
const grp = tab.getRowGroup();
|
|
7111
|
+
if (grp.hasBrace) return;
|
|
7112
|
+
const left2 = this.getStaffLineLeft();
|
|
7113
|
+
const top = tab.getTopLineY();
|
|
7114
|
+
const bottom = tab.getBottomLineY();
|
|
7115
|
+
ctx.color(DocumentColor.Tab_Frame).lineWidth(1).strokeLine(left2, top, left2, bottom);
|
|
7116
|
+
});
|
|
7117
|
+
}
|
|
6587
7118
|
this.signatures.forEach((signature) => signature.draw(ctx));
|
|
6588
7119
|
this.tabStringNotes.forEach((obj) => obj.draw(ctx));
|
|
6589
7120
|
this.barLineLeft.draw(ctx);
|
|
@@ -6599,8 +7130,7 @@ var ObjMeasure = class extends MusicObject {
|
|
|
6599
7130
|
};
|
|
6600
7131
|
|
|
6601
7132
|
// src/score/engine/layout-object.ts
|
|
6602
|
-
import { MusicError as
|
|
6603
|
-
import { AnchoredRect as AnchoredRect21, asMulti as asMulti2, IndexArray as IndexArray3, UniMap as UniMap7 } from "@tspro/ts-utils-lib";
|
|
7133
|
+
import { MusicError as MusicError12, MusicErrorType as MusicErrorType12 } from "@tspro/web-music-score/core";
|
|
6604
7134
|
var LayoutGroupId = /* @__PURE__ */ ((LayoutGroupId2) => {
|
|
6605
7135
|
LayoutGroupId2[LayoutGroupId2["TabRhythm"] = 0] = "TabRhythm";
|
|
6606
7136
|
LayoutGroupId2[LayoutGroupId2["Fermata"] = 1] = "Fermata";
|
|
@@ -6615,7 +7145,7 @@ var LayoutGroupId = /* @__PURE__ */ ((LayoutGroupId2) => {
|
|
|
6615
7145
|
LayoutGroupId2[LayoutGroupId2["LyricsVerse3"] = 10] = "LyricsVerse3";
|
|
6616
7146
|
return LayoutGroupId2;
|
|
6617
7147
|
})(LayoutGroupId || {});
|
|
6618
|
-
var LayoutGroupIdAttrs = new
|
|
7148
|
+
var LayoutGroupIdAttrs = new UniMap([
|
|
6619
7149
|
[0 /* TabRhythm */, { rowAlign: true }],
|
|
6620
7150
|
[1 /* Fermata */, { reserveSpace: true }],
|
|
6621
7151
|
[2 /* NoteLabel */, { reserveSpace: true }],
|
|
@@ -6635,7 +7165,7 @@ function requireParentMeasure(p) {
|
|
|
6635
7165
|
}
|
|
6636
7166
|
p = p.getParent();
|
|
6637
7167
|
}
|
|
6638
|
-
throw new
|
|
7168
|
+
throw new MusicError12(MusicErrorType12.Score, "Parent measure is required but not found!");
|
|
6639
7169
|
}
|
|
6640
7170
|
var StaffGroup = class {
|
|
6641
7171
|
constructor(groupName, staffsTabsAndGroups, verticalPosition) {
|
|
@@ -6659,7 +7189,7 @@ var LayoutObjectWrapper = class {
|
|
|
6659
7189
|
this.row = this.measure.row;
|
|
6660
7190
|
let anchor = this.musicObj.getParent();
|
|
6661
7191
|
if (!anchor) {
|
|
6662
|
-
throw new
|
|
7192
|
+
throw new MusicError12(MusicErrorType12.Score, "Parent music object is required as an anchor.");
|
|
6663
7193
|
}
|
|
6664
7194
|
this.anchor = anchor;
|
|
6665
7195
|
this.anchor.addAnchoredLayoutObject(this);
|
|
@@ -6687,7 +7217,7 @@ var LayoutObjectWrapper = class {
|
|
|
6687
7217
|
let staticShapeRects = staticObj.getShapeRects();
|
|
6688
7218
|
objShapeRects.forEach((objR) => {
|
|
6689
7219
|
staticShapeRects.forEach((staticR) => {
|
|
6690
|
-
if (
|
|
7220
|
+
if (AnchoredRect.overlapX(objR, staticR)) {
|
|
6691
7221
|
y = verticalPos === 1 /* Below */ ? Math.max(y, staticR.bottom + objR.toph + objR.anchorY) : Math.min(y, staticR.top - objR.bottomh - objR.anchorY);
|
|
6692
7222
|
}
|
|
6693
7223
|
});
|
|
@@ -6695,13 +7225,6 @@ var LayoutObjectWrapper = class {
|
|
|
6695
7225
|
});
|
|
6696
7226
|
return y;
|
|
6697
7227
|
}
|
|
6698
|
-
getTextContent() {
|
|
6699
|
-
if (this.musicObj instanceof ObjText || this.musicObj instanceof ObjSpecialText) {
|
|
6700
|
-
return this.musicObj.getText();
|
|
6701
|
-
} else {
|
|
6702
|
-
return void 0;
|
|
6703
|
-
}
|
|
6704
|
-
}
|
|
6705
7228
|
layout(ctx) {
|
|
6706
7229
|
this.line.addObject(this);
|
|
6707
7230
|
}
|
|
@@ -6719,7 +7242,7 @@ var LayoutGroup = class {
|
|
|
6719
7242
|
constructor(layoutGroupId) {
|
|
6720
7243
|
this.layoutGroupId = layoutGroupId;
|
|
6721
7244
|
// key = VerticalPos
|
|
6722
|
-
__publicField(this, "layoutObject",
|
|
7245
|
+
__publicField(this, "layoutObject", asMulti(new IndexArray()));
|
|
6723
7246
|
__publicField(this, "rowAlign");
|
|
6724
7247
|
__publicField(this, "reserveSpace");
|
|
6725
7248
|
__publicField(this, "padding");
|
|
@@ -6749,12 +7272,15 @@ var LayoutGroup = class {
|
|
|
6749
7272
|
};
|
|
6750
7273
|
|
|
6751
7274
|
// src/score/engine/obj-staff-and-tab.ts
|
|
6752
|
-
var
|
|
7275
|
+
var ObjNotationLine6 = class extends MusicObject {
|
|
6753
7276
|
constructor(row) {
|
|
6754
7277
|
super(row);
|
|
6755
7278
|
this.row = row;
|
|
6756
7279
|
__publicField(this, "objects", []);
|
|
6757
|
-
__publicField(this, "layoutGroups", new
|
|
7280
|
+
__publicField(this, "layoutGroups", new UniMap());
|
|
7281
|
+
}
|
|
7282
|
+
getRowGroup() {
|
|
7283
|
+
return this.row.getRowGroupByLineId(this.id);
|
|
6758
7284
|
}
|
|
6759
7285
|
addObject(o) {
|
|
6760
7286
|
this.objects.push(o);
|
|
@@ -6769,7 +7295,7 @@ var ObjNotationLine5 = class extends MusicObject {
|
|
|
6769
7295
|
this.layoutGroups.forEach((layoutGroup) => layoutGroup.layout(ctx));
|
|
6770
7296
|
}
|
|
6771
7297
|
layoutLayoutGroups(ctx) {
|
|
6772
|
-
for (const groupId of
|
|
7298
|
+
for (const groupId of utils_exports.Enum.getEnumValues(LayoutGroupId)) {
|
|
6773
7299
|
const layoutGroup = this.getLayoutGroup(groupId);
|
|
6774
7300
|
if (layoutGroup) {
|
|
6775
7301
|
this.layoutLayoutGroup(ctx, layoutGroup, 0 /* Above */);
|
|
@@ -6820,11 +7346,20 @@ var ObjNotationLine5 = class extends MusicObject {
|
|
|
6820
7346
|
});
|
|
6821
7347
|
}
|
|
6822
7348
|
}
|
|
7349
|
+
drawVerticalLine(ctx, left, width, isSystemBarLine = false) {
|
|
7350
|
+
ctx.color(this.getConfig().type === "tab" ? DocumentColor.Tab_Frame : DocumentColor.Staff_Frame);
|
|
7351
|
+
const i = this.row.getNotationLines().indexOf(this);
|
|
7352
|
+
const nextLine = i >= 0 ? this.row.getNotationLines()[i + 1] : void 0;
|
|
7353
|
+
const isGroupLine = this.getRowGroup().lines.length > 1;
|
|
7354
|
+
const isGrandTreble = this instanceof ObjStaff && this.isGrandTreble();
|
|
7355
|
+
const top = this.getTopLineY();
|
|
7356
|
+
const bottom = nextLine && (isSystemBarLine || isGroupLine || isGrandTreble) ? nextLine.getTopLineY() : this.getBottomLineY();
|
|
7357
|
+
ctx.fillRect(left, top, width, bottom - top);
|
|
7358
|
+
}
|
|
6823
7359
|
};
|
|
6824
|
-
var ObjStaff = class extends
|
|
7360
|
+
var ObjStaff = class extends ObjNotationLine6 {
|
|
6825
7361
|
constructor(row, staffConfig, id) {
|
|
6826
7362
|
super(row);
|
|
6827
|
-
this.row = row;
|
|
6828
7363
|
this.staffConfig = staffConfig;
|
|
6829
7364
|
this.id = id;
|
|
6830
7365
|
__publicField(this, "clefImageAsset");
|
|
@@ -6848,7 +7383,7 @@ var ObjStaff = class extends ObjNotationLine5 {
|
|
|
6848
7383
|
this.clefLineDiatonicId = getDiatonicId("F3", staffConfig.isOctaveDown === true);
|
|
6849
7384
|
this.middleLineDiatonicId = this.clefLineDiatonicId - 2;
|
|
6850
7385
|
} else {
|
|
6851
|
-
throw new
|
|
7386
|
+
throw new MusicError13(MusicErrorType13.Score, `Invalid staffConfig.clef ${staffConfig.clef}.`);
|
|
6852
7387
|
}
|
|
6853
7388
|
this.topLineDiatonicId = this.middleLineDiatonicId + 4;
|
|
6854
7389
|
this.bottomLineDiatonicId = this.middleLineDiatonicId - 4;
|
|
@@ -6879,9 +7414,14 @@ var ObjStaff = class extends ObjNotationLine5 {
|
|
|
6879
7414
|
return this.bottomLineY;
|
|
6880
7415
|
}
|
|
6881
7416
|
joinGrandStaff(staff) {
|
|
6882
|
-
if (staff !== this)
|
|
7417
|
+
if (staff !== this)
|
|
6883
7418
|
this.joinedGrandStaff = staff;
|
|
6884
|
-
|
|
7419
|
+
}
|
|
7420
|
+
isGrandTreble() {
|
|
7421
|
+
return this.joinedGrandStaff !== void 0 && this.staffConfig.clef === "G" /* G */;
|
|
7422
|
+
}
|
|
7423
|
+
isGrandBass() {
|
|
7424
|
+
return this.joinedGrandStaff !== void 0 && this.staffConfig.clef === "F" /* F */;
|
|
6885
7425
|
}
|
|
6886
7426
|
getLineSpacing() {
|
|
6887
7427
|
return (this.bottomLineY - this.topLineY) / 4;
|
|
@@ -6899,7 +7439,7 @@ var ObjStaff = class extends ObjNotationLine5 {
|
|
|
6899
7439
|
} else if (this.joinedGrandStaff && this.joinedGrandStaff.containsDiatonicId(diatonicId)) {
|
|
6900
7440
|
return this.joinedGrandStaff.getDiatonicIdY(diatonicId);
|
|
6901
7441
|
} else {
|
|
6902
|
-
throw new
|
|
7442
|
+
throw new MusicError13(MusicErrorType13.Score, "Staff does not contain diatonicId " + diatonicId);
|
|
6903
7443
|
}
|
|
6904
7444
|
}
|
|
6905
7445
|
getActualStaff(diatonicId) {
|
|
@@ -6908,7 +7448,7 @@ var ObjStaff = class extends ObjNotationLine5 {
|
|
|
6908
7448
|
} else if (this.joinedGrandStaff && this.joinedGrandStaff.containsDiatonicId(diatonicId)) {
|
|
6909
7449
|
return this.joinedGrandStaff;
|
|
6910
7450
|
} else {
|
|
6911
|
-
throw new
|
|
7451
|
+
throw new MusicError13(MusicErrorType13.Score, "Staff does not contain diatonicId " + diatonicId);
|
|
6912
7452
|
}
|
|
6913
7453
|
}
|
|
6914
7454
|
getDiatonicIdAt(y) {
|
|
@@ -6922,7 +7462,7 @@ var ObjStaff = class extends ObjNotationLine5 {
|
|
|
6922
7462
|
return diatonicId % 2 !== this.middleLineDiatonicId % 2;
|
|
6923
7463
|
}
|
|
6924
7464
|
containsVoiceId(voiceId) {
|
|
6925
|
-
return
|
|
7465
|
+
return guard_exports.isUndefined(this.staffConfig.voiceId) || utils_exports.Arr.toArray(this.staffConfig.voiceId).includes(voiceId);
|
|
6926
7466
|
}
|
|
6927
7467
|
calcTop() {
|
|
6928
7468
|
let top = this.topLineY;
|
|
@@ -6952,7 +7492,7 @@ var ObjStaff = class extends ObjNotationLine5 {
|
|
|
6952
7492
|
let h = unitSize * DocumentSettings.StaffHeight;
|
|
6953
7493
|
this.topLineY = -h / 2;
|
|
6954
7494
|
this.bottomLineY = h / 2;
|
|
6955
|
-
this.rect = new
|
|
7495
|
+
this.rect = new AnchoredRect(0, 0, this.topLineY, this.bottomLineY);
|
|
6956
7496
|
}
|
|
6957
7497
|
layoutWidth(ctx) {
|
|
6958
7498
|
this.rect.left = this.row.getRect().left;
|
|
@@ -6973,10 +7513,9 @@ var ObjStaff = class extends ObjNotationLine5 {
|
|
|
6973
7513
|
draw(ctx) {
|
|
6974
7514
|
}
|
|
6975
7515
|
};
|
|
6976
|
-
var ObjTab = class extends
|
|
7516
|
+
var ObjTab = class extends ObjNotationLine6 {
|
|
6977
7517
|
constructor(row, tabConfig, id) {
|
|
6978
7518
|
super(row);
|
|
6979
|
-
this.row = row;
|
|
6980
7519
|
this.tabConfig = tabConfig;
|
|
6981
7520
|
this.id = id;
|
|
6982
7521
|
__publicField(this, "top", 0);
|
|
@@ -6984,7 +7523,7 @@ var ObjTab = class extends ObjNotationLine5 {
|
|
|
6984
7523
|
__publicField(this, "tuningName");
|
|
6985
7524
|
__publicField(this, "tuningStrings");
|
|
6986
7525
|
__publicField(this, "mi");
|
|
6987
|
-
if (
|
|
7526
|
+
if (guard_exports.isArray(tabConfig.tuning)) {
|
|
6988
7527
|
this.tuningName = void 0;
|
|
6989
7528
|
this.tuningStrings = tabConfig.tuning.map((noteName) => Note8.getNote(noteName)).reverse();
|
|
6990
7529
|
} else if (typeof tabConfig.tuning === "string") {
|
|
@@ -7035,7 +7574,7 @@ var ObjTab = class extends ObjNotationLine5 {
|
|
|
7035
7574
|
return this.bottom;
|
|
7036
7575
|
}
|
|
7037
7576
|
containsVoiceId(voiceId) {
|
|
7038
|
-
return
|
|
7577
|
+
return guard_exports.isUndefined(this.tabConfig.voiceId) || utils_exports.Arr.toArray(this.tabConfig.voiceId).includes(voiceId);
|
|
7039
7578
|
}
|
|
7040
7579
|
containsDiatonicId(diatonicId) {
|
|
7041
7580
|
return true;
|
|
@@ -7058,7 +7597,7 @@ var ObjTab = class extends ObjNotationLine5 {
|
|
|
7058
7597
|
let h = unitSize * DocumentSettings.TabHeight;
|
|
7059
7598
|
this.top = -h / 2;
|
|
7060
7599
|
this.bottom = h / 2;
|
|
7061
|
-
this.rect = new
|
|
7600
|
+
this.rect = new AnchoredRect(0, 0, this.top, this.bottom);
|
|
7062
7601
|
}
|
|
7063
7602
|
layoutWidth(ctx) {
|
|
7064
7603
|
this.rect.left = this.row.getRect().left;
|
|
@@ -7081,11 +7620,15 @@ var ObjTab = class extends ObjNotationLine5 {
|
|
|
7081
7620
|
};
|
|
7082
7621
|
|
|
7083
7622
|
// src/score/engine/obj-score-row.ts
|
|
7084
|
-
import { MusicError as
|
|
7085
|
-
import { AnchoredRect as AnchoredRect24, Guard as Guard10, Utils as Utils11 } from "@tspro/ts-utils-lib";
|
|
7623
|
+
import { MusicError as MusicError14, MusicErrorType as MusicErrorType14 } from "@tspro/web-music-score/core";
|
|
7086
7624
|
|
|
7087
7625
|
// src/score/engine/obj-score-row-group.ts
|
|
7088
|
-
|
|
7626
|
+
function parseInstr(instr) {
|
|
7627
|
+
const instrName = (instr.startsWith("!{") ? instr.substring(2) : instr.startsWith("!") ? instr.substring(1) : instr).trim();
|
|
7628
|
+
const hideInstr = instr.startsWith("!");
|
|
7629
|
+
const hideBrace = instr.startsWith("!{");
|
|
7630
|
+
return { instrName, hideInstr, hideBrace };
|
|
7631
|
+
}
|
|
7089
7632
|
var ObjScoreRowGroup = class extends MusicObject {
|
|
7090
7633
|
constructor(lines) {
|
|
7091
7634
|
var _a;
|
|
@@ -7093,11 +7636,16 @@ var ObjScoreRowGroup = class extends MusicObject {
|
|
|
7093
7636
|
this.lines = lines;
|
|
7094
7637
|
__publicField(this, "space", 0);
|
|
7095
7638
|
__publicField(this, "instrument");
|
|
7639
|
+
__publicField(this, "hasBrace");
|
|
7096
7640
|
__publicField(this, "instrText");
|
|
7097
|
-
__publicField(this, "braceRect", new
|
|
7641
|
+
__publicField(this, "braceRect", new AnchoredRect());
|
|
7098
7642
|
__publicField(this, "mi");
|
|
7099
|
-
|
|
7100
|
-
|
|
7643
|
+
const color = DocumentColor.RowGroup_Instrument;
|
|
7644
|
+
const instr = parseInstr((_a = lines[0].getConfig().instrument) != null ? _a : "");
|
|
7645
|
+
this.instrument = instr.instrName;
|
|
7646
|
+
this.hasBrace = instr.hideBrace ? false : this.hasInstrument && lines.length >= 2;
|
|
7647
|
+
const text = instr.hideInstr ? "" : this.instrument;
|
|
7648
|
+
this.instrText = new ObjText(this, { text, color, scale: 1 }, 1, 0.5);
|
|
7101
7649
|
this.mi = new MScoreRowGroup(this);
|
|
7102
7650
|
}
|
|
7103
7651
|
getMusicInterface() {
|
|
@@ -7106,12 +7654,12 @@ var ObjScoreRowGroup = class extends MusicObject {
|
|
|
7106
7654
|
get row() {
|
|
7107
7655
|
return this.lines[0].row;
|
|
7108
7656
|
}
|
|
7109
|
-
get hasBrace() {
|
|
7110
|
-
return this.hasInstrument && this.lines.length > 1;
|
|
7111
|
-
}
|
|
7112
7657
|
get hasInstrument() {
|
|
7113
7658
|
return this.instrument.length > 0;
|
|
7114
7659
|
}
|
|
7660
|
+
hasNotationLine(line) {
|
|
7661
|
+
return this.lines.includes(line);
|
|
7662
|
+
}
|
|
7115
7663
|
pick(x, y) {
|
|
7116
7664
|
if (!this.getRect().contains(x, y))
|
|
7117
7665
|
return [];
|
|
@@ -7129,7 +7677,7 @@ var ObjScoreRowGroup = class extends MusicObject {
|
|
|
7129
7677
|
layout(ctx) {
|
|
7130
7678
|
this.space = ctx.unitSize;
|
|
7131
7679
|
this.instrText.layout(ctx);
|
|
7132
|
-
this.braceRect = new
|
|
7680
|
+
this.braceRect = new AnchoredRect(-(this.hasBrace ? ctx.unitSize * 5 : 0), 0, 0, 0);
|
|
7133
7681
|
this.forceRectUpdate();
|
|
7134
7682
|
}
|
|
7135
7683
|
layoutToNotationLines() {
|
|
@@ -7146,7 +7694,8 @@ var ObjScoreRowGroup = class extends MusicObject {
|
|
|
7146
7694
|
draw(ctx) {
|
|
7147
7695
|
this.instrText.draw(ctx);
|
|
7148
7696
|
if (this.hasBrace) {
|
|
7149
|
-
|
|
7697
|
+
const r = this.braceRect;
|
|
7698
|
+
ctx.color(DocumentColor.RowGroup_Frame).lineWidth(1).drawBracket(r, "{");
|
|
7150
7699
|
}
|
|
7151
7700
|
}
|
|
7152
7701
|
};
|
|
@@ -7200,6 +7749,7 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7200
7749
|
__publicField(this, "staves");
|
|
7201
7750
|
__publicField(this, "tabs");
|
|
7202
7751
|
__publicField(this, "measures", []);
|
|
7752
|
+
__publicField(this, "rowGroupByLine");
|
|
7203
7753
|
__publicField(this, "needLayout", true);
|
|
7204
7754
|
__publicField(this, "mi");
|
|
7205
7755
|
this.notationLines = this.createNotationLines();
|
|
@@ -7216,6 +7766,7 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7216
7766
|
}
|
|
7217
7767
|
}
|
|
7218
7768
|
this.rowGroups = lineGroups.filter((lines) => lines.length > 0).map((lines) => new ObjScoreRowGroup(lines));
|
|
7769
|
+
this.rowGroupByLine = this.notationLines.map((line) => this.rowGroups.find((grp) => grp.lines.includes(line)));
|
|
7219
7770
|
if (this.prevRow) {
|
|
7220
7771
|
this.prevRow.nextRow = this;
|
|
7221
7772
|
}
|
|
@@ -7242,9 +7793,12 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7242
7793
|
getRowGroups() {
|
|
7243
7794
|
return this.rowGroups;
|
|
7244
7795
|
}
|
|
7796
|
+
getRowGroupByLineId(id) {
|
|
7797
|
+
return this.rowGroupByLine[id];
|
|
7798
|
+
}
|
|
7245
7799
|
findMatchingLine(line) {
|
|
7246
7800
|
return line.row === this ? line : this.notationLines.find(
|
|
7247
|
-
(curLine) =>
|
|
7801
|
+
(curLine) => utils_exports.Obj.deepEqual(line.row.scoreConfig, curLine.row.scoreConfig) && line.id === curLine.id || guard_exports.isNonEmptyString(line.getConfig().name) && line.getConfig().name === curLine.getConfig().name && line.getConfig().type === curLine.getConfig().type
|
|
7248
7802
|
);
|
|
7249
7803
|
}
|
|
7250
7804
|
get regions() {
|
|
@@ -7267,7 +7821,7 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7267
7821
|
if (topStaff) {
|
|
7268
7822
|
return topStaff;
|
|
7269
7823
|
} else {
|
|
7270
|
-
throw new
|
|
7824
|
+
throw new MusicError14(MusicErrorType14.Score, "Top staff is required!");
|
|
7271
7825
|
}
|
|
7272
7826
|
}
|
|
7273
7827
|
getBottomStaff() {
|
|
@@ -7275,7 +7829,7 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7275
7829
|
if (bottomStaff) {
|
|
7276
7830
|
return bottomStaff;
|
|
7277
7831
|
} else {
|
|
7278
|
-
throw new
|
|
7832
|
+
throw new MusicError14(MusicErrorType14.Score, "Bottom staff is required!");
|
|
7279
7833
|
}
|
|
7280
7834
|
}
|
|
7281
7835
|
getStaff(diatonicId) {
|
|
@@ -7322,7 +7876,7 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7322
7876
|
let r = this.getRect();
|
|
7323
7877
|
let firstMeasure = this.getFirstMeasure();
|
|
7324
7878
|
let left = firstMeasure ? firstMeasure.getColumnsContentRect().left : r.left;
|
|
7325
|
-
return new
|
|
7879
|
+
return new AnchoredRect(left, (left + r.right) / 2, r.right, r.top, r.anchorY, r.bottom);
|
|
7326
7880
|
}
|
|
7327
7881
|
getDiatonicIdAt(y) {
|
|
7328
7882
|
for (let i = 0; i < this.notationLines.length; i++) {
|
|
@@ -7369,7 +7923,7 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7369
7923
|
return "up" /* Up */;
|
|
7370
7924
|
}
|
|
7371
7925
|
let diatonicIds = noteGroupDiatonicIds.length > 0 ? noteGroupDiatonicIds : restDiatonicIds;
|
|
7372
|
-
let avgDiatonicId = Math.floor(
|
|
7926
|
+
let avgDiatonicId = Math.floor(utils_exports.Math.avg(...diatonicIds));
|
|
7373
7927
|
let staves = this.getStaves().filter((staff) => staff.containsVoiceId(voiceId) && staff.containsDiatonicId(avgDiatonicId));
|
|
7374
7928
|
return staves.length > 0 ? avgDiatonicId >= staves[0].middleLineDiatonicId ? "down" /* Down */ : "up" /* Up */ : "up" /* Up */;
|
|
7375
7929
|
}
|
|
@@ -7401,7 +7955,7 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7401
7955
|
if (!this.needLayout) {
|
|
7402
7956
|
return;
|
|
7403
7957
|
}
|
|
7404
|
-
this.rect = new
|
|
7958
|
+
this.rect = new AnchoredRect(this.regions.left, this.regions.right, 0, 0);
|
|
7405
7959
|
this.notationLines.forEach((line) => line.layoutWidth(ctx));
|
|
7406
7960
|
this.rowGroups.forEach((grp) => grp.setRight(this.regions.instrRight));
|
|
7407
7961
|
let targetColumnsAreaWidth = this.regions.staffWidth;
|
|
@@ -7440,7 +7994,7 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7440
7994
|
top = Math.min(...this.measures.map((m) => m.getRect().top));
|
|
7441
7995
|
bottom = Math.max(...this.measures.map((m) => m.getRect().bottom));
|
|
7442
7996
|
}
|
|
7443
|
-
this.rect = new
|
|
7997
|
+
this.rect = new AnchoredRect(left, right, top, bottom);
|
|
7444
7998
|
}
|
|
7445
7999
|
alignStemsToBeams() {
|
|
7446
8000
|
this.measures.forEach((m) => m.alignStemsToBeams());
|
|
@@ -7484,6 +8038,10 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7484
8038
|
this.notationLines.forEach((l) => l.offset(dx, dy));
|
|
7485
8039
|
this.rowGroups.forEach((grp) => grp.offset(dx, dy));
|
|
7486
8040
|
}
|
|
8041
|
+
getStaffLineLeft() {
|
|
8042
|
+
var _a;
|
|
8043
|
+
return (_a = this.getFirstMeasure()) == null ? void 0 : _a.getStaffLineLeft();
|
|
8044
|
+
}
|
|
7487
8045
|
draw(ctx) {
|
|
7488
8046
|
ctx.drawDebugRect(this.getRect());
|
|
7489
8047
|
const { left, top, width, height } = this.getRect();
|
|
@@ -7491,21 +8049,18 @@ var ObjScoreRow = class extends MusicObject {
|
|
|
7491
8049
|
ctx.save();
|
|
7492
8050
|
ctx.rect(left - p, top, width + 2 * p, height);
|
|
7493
8051
|
ctx.clip();
|
|
7494
|
-
if (this.getFirstMeasure() && (this.notationLines.length > 1 || this.notationLines[0] instanceof ObjTab)) {
|
|
7495
|
-
let left2 = this.getFirstMeasure().getStaffLineLeft();
|
|
7496
|
-
let top2 = Math.min(...this.notationLines.map((line) => line.getTopLineY()));
|
|
7497
|
-
let bottom = Math.max(...this.notationLines.map((line) => line.getBottomLineY()));
|
|
7498
|
-
ctx.color("black").lineWidth(1).strokeLine(left2, top2, left2, bottom);
|
|
7499
|
-
}
|
|
7500
8052
|
this.measures.forEach((m) => m.draw(ctx));
|
|
7501
8053
|
this.notationLines.forEach((m) => m.draw(ctx));
|
|
8054
|
+
const staffLeft = this.getStaffLineLeft();
|
|
8055
|
+
if (staffLeft !== void 0 && this.notationLines.length > 1) {
|
|
8056
|
+
this.notationLines.forEach((line) => line.drawVerticalLine(ctx, staffLeft, ctx._lineWidth, true));
|
|
8057
|
+
}
|
|
7502
8058
|
this.rowGroups.forEach((grp) => grp.draw(ctx));
|
|
7503
8059
|
ctx.restore();
|
|
7504
8060
|
}
|
|
7505
8061
|
};
|
|
7506
8062
|
|
|
7507
8063
|
// src/score/engine/obj-header.ts
|
|
7508
|
-
import { AnchoredRect as AnchoredRect25 } from "@tspro/ts-utils-lib";
|
|
7509
8064
|
var ObjHeader = class extends MusicObject {
|
|
7510
8065
|
constructor(doc, title, composer, arranger) {
|
|
7511
8066
|
super(doc);
|
|
@@ -7518,9 +8073,12 @@ var ObjHeader = class extends MusicObject {
|
|
|
7518
8073
|
__publicField(this, "arrangerText");
|
|
7519
8074
|
__publicField(this, "mi");
|
|
7520
8075
|
this.mi = new MHeader(this);
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
8076
|
+
const titleColor = DocumentColor.Header_Title;
|
|
8077
|
+
const compColor = DocumentColor.Header_Composer;
|
|
8078
|
+
const arrColor = DocumentColor.Header_Arranger;
|
|
8079
|
+
this.titleText = this.title ? new ObjText(this, { text: this.title, color: titleColor, scale: 2 }, 0.5, 0) : void 0;
|
|
8080
|
+
this.composerText = this.composer ? new ObjText(this, { text: this.composer, color: compColor }, 1, 0) : void 0;
|
|
8081
|
+
this.arrangerText = this.arranger ? new ObjText(this, { text: "Arr.: " + this.arranger, color: arrColor }, 1, 0) : void 0;
|
|
7524
8082
|
}
|
|
7525
8083
|
getMusicInterface() {
|
|
7526
8084
|
return this.mi;
|
|
@@ -7553,7 +8111,7 @@ var ObjHeader = class extends MusicObject {
|
|
|
7553
8111
|
let top = 0;
|
|
7554
8112
|
const left = this.doc.regions.staffLeft;
|
|
7555
8113
|
const right = this.doc.regions.staffRight;
|
|
7556
|
-
this.rect = new
|
|
8114
|
+
this.rect = new AnchoredRect(left, right, 0, 0);
|
|
7557
8115
|
if (this.titleText) {
|
|
7558
8116
|
this.titleText.layout(ctx);
|
|
7559
8117
|
this.titleText.setCenterX((left + right) / 2);
|
|
@@ -7602,8 +8160,7 @@ var ObjHeader = class extends MusicObject {
|
|
|
7602
8160
|
};
|
|
7603
8161
|
|
|
7604
8162
|
// src/score/engine/obj-document.ts
|
|
7605
|
-
import {
|
|
7606
|
-
import { MusicError as MusicError17, MusicErrorType as MusicErrorType17 } from "@tspro/web-music-score/core";
|
|
8163
|
+
import { MusicError as MusicError15, MusicErrorType as MusicErrorType15 } from "@tspro/web-music-score/core";
|
|
7607
8164
|
var ObjDocument = class extends MusicObject {
|
|
7608
8165
|
constructor() {
|
|
7609
8166
|
super(void 0);
|
|
@@ -7617,7 +8174,7 @@ var ObjDocument = class extends MusicObject {
|
|
|
7617
8174
|
__publicField(this, "header");
|
|
7618
8175
|
__publicField(this, "newRowRequested", false);
|
|
7619
8176
|
__publicField(this, "allConnectiveProps", []);
|
|
7620
|
-
__publicField(this, "staffGroups", new
|
|
8177
|
+
__publicField(this, "staffGroups", new UniMap());
|
|
7621
8178
|
__publicField(this, "mi");
|
|
7622
8179
|
this.mi = new MDocument2(this);
|
|
7623
8180
|
}
|
|
@@ -7625,7 +8182,7 @@ var ObjDocument = class extends MusicObject {
|
|
|
7625
8182
|
return this.mi;
|
|
7626
8183
|
}
|
|
7627
8184
|
setScoreConfiguration(config) {
|
|
7628
|
-
if (
|
|
8185
|
+
if (guard_exports.isEnumValue(config, StaffPreset)) {
|
|
7629
8186
|
switch (config) {
|
|
7630
8187
|
default:
|
|
7631
8188
|
case "treble" /* Treble */:
|
|
@@ -7653,7 +8210,7 @@ var ObjDocument = class extends MusicObject {
|
|
|
7653
8210
|
];
|
|
7654
8211
|
break;
|
|
7655
8212
|
}
|
|
7656
|
-
} else if (
|
|
8213
|
+
} else if (guard_exports.isArray(config)) {
|
|
7657
8214
|
this.curScoreConfig = config;
|
|
7658
8215
|
} else {
|
|
7659
8216
|
this.curScoreConfig = [config];
|
|
@@ -7666,10 +8223,10 @@ var ObjDocument = class extends MusicObject {
|
|
|
7666
8223
|
}
|
|
7667
8224
|
if (treble && treble.type === "staff" && treble.isGrand) {
|
|
7668
8225
|
if (treble.grandId !== void 0) {
|
|
7669
|
-
throw new
|
|
8226
|
+
throw new MusicError15(MusicErrorType15.Score, `Grand staff error: mixing isGrand and grandId!`);
|
|
7670
8227
|
} else if (bass && bass.type === "staff" && bass.isGrand) {
|
|
7671
8228
|
if (bass.grandId !== void 0) {
|
|
7672
|
-
throw new
|
|
8229
|
+
throw new MusicError15(MusicErrorType15.Score, `Grand staff error: mixing isGrand and grandId!`);
|
|
7673
8230
|
} else {
|
|
7674
8231
|
treble.grandId = grandId;
|
|
7675
8232
|
bass.grandId = grandId;
|
|
@@ -7677,7 +8234,7 @@ var ObjDocument = class extends MusicObject {
|
|
|
7677
8234
|
cfgId += 2;
|
|
7678
8235
|
}
|
|
7679
8236
|
} else {
|
|
7680
|
-
throw new
|
|
8237
|
+
throw new MusicError15(MusicErrorType15.Score, `Grand staff error: invalid use of isGrand!`);
|
|
7681
8238
|
}
|
|
7682
8239
|
} else {
|
|
7683
8240
|
cfgId++;
|
|
@@ -7688,20 +8245,20 @@ var ObjDocument = class extends MusicObject {
|
|
|
7688
8245
|
let bass = this.curScoreConfig[cfgId + 1];
|
|
7689
8246
|
if (treble && bass && treble.type === "staff" && bass.type === "staff" && treble.grandId !== void 0 && treble.grandId === bass.grandId) {
|
|
7690
8247
|
if (usedGrandIdes.includes(treble.grandId)) {
|
|
7691
|
-
throw new
|
|
8248
|
+
throw new MusicError15(MusicErrorType15.Score, `Grand staff error: grandId "${treble.grandId}" already used!`);
|
|
7692
8249
|
} else if (treble.clef !== "G" /* G */) {
|
|
7693
|
-
throw new
|
|
8250
|
+
throw new MusicError15(MusicErrorType15.Score, `Grand staff error: Invalid treble clef "${treble.clef}"!`);
|
|
7694
8251
|
} else if (bass.clef !== "F" /* F */) {
|
|
7695
|
-
throw new
|
|
8252
|
+
throw new MusicError15(MusicErrorType15.Score, `Grand staff error: Invalid treble clef "${treble.clef}"!`);
|
|
7696
8253
|
} else if (treble.isOctaveDown || bass.isOctaveDown) {
|
|
7697
|
-
throw new
|
|
8254
|
+
throw new MusicError15(MusicErrorType15.Score, `Grand staff error: cannot use isOctaveDown option!`);
|
|
7698
8255
|
}
|
|
7699
8256
|
usedGrandIdes.push(treble.grandId);
|
|
7700
8257
|
treble.minNote = "C4";
|
|
7701
8258
|
bass.maxNote = "B3";
|
|
7702
8259
|
cfgId += 2;
|
|
7703
8260
|
} else if (treble && treble.type === "staff" && treble.grandId !== void 0) {
|
|
7704
|
-
throw new
|
|
8261
|
+
throw new MusicError15(MusicErrorType15.Score, `Grand staff error: invalid use of grandId "${treble.grandId}"!`);
|
|
7705
8262
|
} else {
|
|
7706
8263
|
cfgId++;
|
|
7707
8264
|
}
|
|
@@ -7847,7 +8404,7 @@ var ObjDocument = class extends MusicObject {
|
|
|
7847
8404
|
this.rows.forEach((row) => row.layoutStretch(ctx));
|
|
7848
8405
|
this.rows.forEach((row) => row.layoutLayoutGroups(ctx));
|
|
7849
8406
|
this.rows.forEach((row) => row.layoutSetNotationLines(ctx));
|
|
7850
|
-
this.rect = new
|
|
8407
|
+
this.rect = new AnchoredRect();
|
|
7851
8408
|
if (this.header) {
|
|
7852
8409
|
this.header.layout(ctx);
|
|
7853
8410
|
this.rect.expandInPlace(this.header.getRect());
|
|
@@ -7864,13 +8421,10 @@ var ObjDocument = class extends MusicObject {
|
|
|
7864
8421
|
}
|
|
7865
8422
|
drawContent() {
|
|
7866
8423
|
const { ctx } = this;
|
|
7867
|
-
if (!ctx)
|
|
7868
|
-
return;
|
|
7869
|
-
}
|
|
8424
|
+
if (!ctx) return;
|
|
7870
8425
|
this.rows.forEach((row) => row.draw(ctx));
|
|
7871
|
-
if (this.header)
|
|
8426
|
+
if (this.header)
|
|
7872
8427
|
this.header.draw(ctx);
|
|
7873
|
-
}
|
|
7874
8428
|
}
|
|
7875
8429
|
pickStaffPosAt(x, y) {
|
|
7876
8430
|
if (!this.rect.contains(x, y)) {
|
|
@@ -7913,7 +8467,7 @@ var ObjDocument = class extends MusicObject {
|
|
|
7913
8467
|
|
|
7914
8468
|
// src/score/pub/document-builder.ts
|
|
7915
8469
|
import { BeamGrouping, isNoteLength, isTupletRatio, KeySignature as KeySignature3, Note as Note10, NoteLength as NoteLength8, RhythmProps as RhythmProps6, Scale as Scale2, ScaleType, SymbolSet as SymbolSet2, TimeSignature as TimeSignature2, TimeSignatures, TuningNameList } from "@tspro/web-music-score/theory";
|
|
7916
|
-
import { MusicError as
|
|
8470
|
+
import { MusicError as MusicError16, MusicErrorType as MusicErrorType16 } from "@tspro/web-music-score/core";
|
|
7917
8471
|
var assertingFunction = "";
|
|
7918
8472
|
function setAssertFunction(fnName, ...fnArgs) {
|
|
7919
8473
|
let argsStr = fnArgs.map((arg) => JSON.stringify(arg)).join(", ");
|
|
@@ -7921,95 +8475,95 @@ function setAssertFunction(fnName, ...fnArgs) {
|
|
|
7921
8475
|
}
|
|
7922
8476
|
function assertArg(...conditions) {
|
|
7923
8477
|
conditions.forEach((condition) => {
|
|
7924
|
-
if (!condition) throw new
|
|
8478
|
+
if (!condition) throw new MusicError16(MusicErrorType16.Score, assertingFunction);
|
|
7925
8479
|
});
|
|
7926
8480
|
}
|
|
7927
8481
|
function assertArgMsg(condition, msg) {
|
|
7928
|
-
if (!condition) throw new
|
|
8482
|
+
if (!condition) throw new MusicError16(MusicErrorType16.Score, msg);
|
|
7929
8483
|
}
|
|
7930
8484
|
function assertBaseConfig(baseConfig) {
|
|
7931
8485
|
var _a;
|
|
7932
8486
|
assertArg(
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
8487
|
+
guard_exports.isObject(baseConfig),
|
|
8488
|
+
guard_exports.isStringOrUndefined(baseConfig.name),
|
|
8489
|
+
guard_exports.isUndefined(baseConfig.voiceId) || isVoiceId(baseConfig.voiceId) || guard_exports.isArray(baseConfig.voiceId) && baseConfig.voiceId.every((voiceId) => isVoiceId(voiceId))
|
|
7936
8490
|
);
|
|
7937
|
-
if (!
|
|
7938
|
-
assertArg(isVoiceId(baseConfig.voiceIds) ||
|
|
8491
|
+
if (!guard_exports.isUndefined(baseConfig.voiceIds)) {
|
|
8492
|
+
assertArg(isVoiceId(baseConfig.voiceIds) || guard_exports.isArray(baseConfig.voiceIds) && baseConfig.voiceIds.every((voiceId) => isVoiceId(voiceId)));
|
|
7939
8493
|
console.warn(`Staff/tab config property 'voiceIds' is deprecated, use 'voiceId' instead.`);
|
|
7940
|
-
let arr =
|
|
7941
|
-
|
|
8494
|
+
let arr = utils_exports.Arr.toArray((_a = baseConfig.voiceId) != null ? _a : []);
|
|
8495
|
+
utils_exports.Arr.toArray(baseConfig.voiceIds).forEach((voiceId) => arr.push(voiceId));
|
|
7942
8496
|
baseConfig.voiceId = arr;
|
|
7943
8497
|
}
|
|
7944
|
-
if (
|
|
7945
|
-
baseConfig.voiceId =
|
|
8498
|
+
if (guard_exports.isArray(baseConfig.voiceId)) {
|
|
8499
|
+
baseConfig.voiceId = utils_exports.Arr.removeDuplicates(baseConfig.voiceId);
|
|
7946
8500
|
}
|
|
7947
|
-
assertArg(
|
|
8501
|
+
assertArg(guard_exports.isStringOrUndefined(baseConfig.instrument));
|
|
7948
8502
|
}
|
|
7949
8503
|
function assertStaffConfig(staffConfig) {
|
|
7950
8504
|
assertBaseConfig(staffConfig);
|
|
7951
8505
|
assertArg(
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
8506
|
+
guard_exports.isObject(staffConfig),
|
|
8507
|
+
guard_exports.isStrictEqual(staffConfig.type, "staff"),
|
|
8508
|
+
guard_exports.isEnumValue(staffConfig.clef, Clef),
|
|
8509
|
+
guard_exports.isBooleanOrUndefined(staffConfig.isOctaveDown),
|
|
8510
|
+
guard_exports.isUndefined(staffConfig.minNote) || Note10.isNote(staffConfig.minNote),
|
|
8511
|
+
guard_exports.isUndefined(staffConfig.maxNote) || Note10.isNote(staffConfig.maxNote),
|
|
8512
|
+
guard_exports.isStringOrUndefined(staffConfig.grandId),
|
|
8513
|
+
guard_exports.isBooleanOrUndefined(staffConfig.isGrand)
|
|
7960
8514
|
);
|
|
7961
|
-
if (!
|
|
8515
|
+
if (!guard_exports.isUndefined(staffConfig.isGrand))
|
|
7962
8516
|
console.warn(`Staff config property 'isGrand' is deprecated, use 'grandId' instead.`);
|
|
7963
8517
|
}
|
|
7964
8518
|
function assertTabConfig(tabConfig) {
|
|
7965
8519
|
assertBaseConfig(tabConfig);
|
|
7966
8520
|
assertArg(
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
8521
|
+
guard_exports.isObject(tabConfig),
|
|
8522
|
+
guard_exports.isStrictEqual(tabConfig.type, "tab"),
|
|
8523
|
+
guard_exports.isUndefined(tabConfig.tuning) || guard_exports.isString(tabConfig.tuning) && guard_exports.isIncluded(tabConfig.tuning, TuningNameList) || guard_exports.isArray(tabConfig.tuning) && guard_exports.isStrictEqual(tabConfig.tuning.length, getStringNumbers().length && tabConfig.tuning.every((s) => Note10.isNote(s)))
|
|
7970
8524
|
);
|
|
7971
8525
|
}
|
|
7972
8526
|
function assertNoteOptions(noteOptions) {
|
|
7973
8527
|
assertArg(
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
8528
|
+
guard_exports.isObject(noteOptions),
|
|
8529
|
+
guard_exports.isBooleanOrUndefined(noteOptions.dotted) || guard_exports.isIntegerGte(noteOptions.dotted, 0),
|
|
8530
|
+
guard_exports.isEnumValueOrUndefined(noteOptions.stem, Stem),
|
|
8531
|
+
guard_exports.isStringOrUndefined(noteOptions.color),
|
|
8532
|
+
guard_exports.isBooleanOrUndefined(noteOptions.arpeggio) || guard_exports.isEnumValue(noteOptions.arpeggio, Arpeggio),
|
|
8533
|
+
guard_exports.isBooleanOrUndefined(noteOptions.staccato),
|
|
8534
|
+
guard_exports.isBooleanOrUndefined(noteOptions.diamond),
|
|
8535
|
+
guard_exports.isBooleanOrUndefined(noteOptions.triplet),
|
|
8536
|
+
guard_exports.isUndefined(noteOptions.string) || isStringNumber(noteOptions.string) || guard_exports.isEmptyArray(noteOptions.string) || guard_exports.isNonEmptyArray(noteOptions.string) && noteOptions.string.every((string) => isStringNumber(string))
|
|
7983
8537
|
);
|
|
7984
|
-
assertArgMsg(
|
|
7985
|
-
assertArgMsg(
|
|
8538
|
+
assertArgMsg(guard_exports.isUndefined(noteOptions.tieSpan), `NoteOptions.tieSpan was removed. Use addConnective("tie", tieSpan)`);
|
|
8539
|
+
assertArgMsg(guard_exports.isUndefined(noteOptions.slurSpan), `NoteOptions.slurSpan was removed. Use addConnective("slur", slurSpan)`);
|
|
7986
8540
|
}
|
|
7987
8541
|
function assertRestOptions(restOptions) {
|
|
7988
8542
|
assertArg(
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
8543
|
+
guard_exports.isObject(restOptions),
|
|
8544
|
+
guard_exports.isBooleanOrUndefined(restOptions.dotted) || guard_exports.isIntegerGte(restOptions.dotted, 0),
|
|
8545
|
+
guard_exports.isStringOrUndefined(restOptions.staffPos) || guard_exports.isInteger(restOptions.staffPos) || restOptions.staffPos instanceof Note10,
|
|
8546
|
+
guard_exports.isStringOrUndefined(restOptions.color),
|
|
8547
|
+
guard_exports.isBooleanOrUndefined(restOptions.hide),
|
|
8548
|
+
guard_exports.isBooleanOrUndefined(restOptions.triplet)
|
|
7995
8549
|
);
|
|
7996
8550
|
}
|
|
7997
8551
|
function assertLyricsOptions(lyricsOptions) {
|
|
7998
8552
|
assertArg(
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8553
|
+
guard_exports.isObject(lyricsOptions),
|
|
8554
|
+
guard_exports.isEnumValueOrUndefined(lyricsOptions.align, LyricsAlign),
|
|
8555
|
+
guard_exports.isEnumValueOrUndefined(lyricsOptions.hyphen, LyricsHyphen)
|
|
8002
8556
|
);
|
|
8003
8557
|
}
|
|
8004
8558
|
function assertMeasureOptions(measureOptions) {
|
|
8005
8559
|
assertArg(
|
|
8006
|
-
|
|
8007
|
-
|
|
8560
|
+
guard_exports.isObject(measureOptions),
|
|
8561
|
+
guard_exports.isBooleanOrUndefined(measureOptions.showNumber)
|
|
8008
8562
|
);
|
|
8009
8563
|
}
|
|
8010
8564
|
function assertStaffTabOrGRoups(staffTabOrGroups) {
|
|
8011
8565
|
assertArg(
|
|
8012
|
-
|
|
8566
|
+
guard_exports.isStringOrUndefined(staffTabOrGroups) || guard_exports.isIntegerGte(staffTabOrGroups, 0) || guard_exports.isNonEmptyArray(staffTabOrGroups) && staffTabOrGroups.every((staffTabOrGroup) => guard_exports.isString(staffTabOrGroup) || guard_exports.isIntegerGte(staffTabOrGroup, 0))
|
|
8013
8567
|
);
|
|
8014
8568
|
}
|
|
8015
8569
|
var _DocumentBuilder = class _DocumentBuilder {
|
|
@@ -8023,19 +8577,19 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8023
8577
|
}
|
|
8024
8578
|
setScoreConfiguration(config) {
|
|
8025
8579
|
setAssertFunction("setScoreConfiguration", config);
|
|
8026
|
-
if (
|
|
8580
|
+
if (guard_exports.isEnumValue(config, StaffPreset)) {
|
|
8027
8581
|
this.doc.setScoreConfiguration(config);
|
|
8028
|
-
} else if (
|
|
8582
|
+
} else if (guard_exports.isObject(config) && config.type === "staff") {
|
|
8029
8583
|
assertStaffConfig(config);
|
|
8030
8584
|
this.doc.setScoreConfiguration(config);
|
|
8031
|
-
} else if (
|
|
8585
|
+
} else if (guard_exports.isObject(config) && config.type === "tab") {
|
|
8032
8586
|
assertTabConfig(config);
|
|
8033
8587
|
this.doc.setScoreConfiguration(config);
|
|
8034
|
-
} else if (
|
|
8588
|
+
} else if (guard_exports.isNonEmptyArray(config)) {
|
|
8035
8589
|
config.forEach((c) => {
|
|
8036
|
-
if (
|
|
8590
|
+
if (guard_exports.isObject(c) && c.type === "staff") {
|
|
8037
8591
|
assertStaffConfig(c);
|
|
8038
|
-
} else if (
|
|
8592
|
+
} else if (guard_exports.isObject(c) && c.type === "tab") {
|
|
8039
8593
|
assertTabConfig(c);
|
|
8040
8594
|
} else {
|
|
8041
8595
|
assertArg(false);
|
|
@@ -8068,9 +8622,9 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8068
8622
|
setHeader(title, composer, arranger) {
|
|
8069
8623
|
setAssertFunction("setHeader", title, composer, arranger);
|
|
8070
8624
|
assertArg(
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8625
|
+
guard_exports.isStringOrUndefined(title),
|
|
8626
|
+
guard_exports.isStringOrUndefined(composer),
|
|
8627
|
+
guard_exports.isStringOrUndefined(arranger)
|
|
8074
8628
|
);
|
|
8075
8629
|
this.doc.setHeader(title, composer, arranger);
|
|
8076
8630
|
return this;
|
|
@@ -8082,7 +8636,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8082
8636
|
*/
|
|
8083
8637
|
setMeasuresPerRow(measuresPerRow) {
|
|
8084
8638
|
setAssertFunction("setMeasuresPerRow", measuresPerRow);
|
|
8085
|
-
assertArg(
|
|
8639
|
+
assertArg(guard_exports.isIntegerGte(measuresPerRow, 1) || guard_exports.isPosInfinity(measuresPerRow));
|
|
8086
8640
|
this.doc.setMeasuresPerRow(measuresPerRow);
|
|
8087
8641
|
return this;
|
|
8088
8642
|
}
|
|
@@ -8100,7 +8654,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8100
8654
|
}
|
|
8101
8655
|
setKeySignature(...args) {
|
|
8102
8656
|
setAssertFunction("setKeySignature", ...args);
|
|
8103
|
-
assertArg(args[0] instanceof Scale2 || args[0] instanceof KeySignature3 ||
|
|
8657
|
+
assertArg(args[0] instanceof Scale2 || args[0] instanceof KeySignature3 || guard_exports.isNonEmptyString(args[0]) && guard_exports.isEnumValueOrUndefined(args[1], ScaleType));
|
|
8104
8658
|
this.getMeasure().setKeySignature(...args);
|
|
8105
8659
|
return this;
|
|
8106
8660
|
}
|
|
@@ -8108,9 +8662,9 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8108
8662
|
setAssertFunction("setTimeSignature", ...args);
|
|
8109
8663
|
if (args[0] instanceof TimeSignature2) {
|
|
8110
8664
|
this.getMeasure().setTimeSignature(args[0]);
|
|
8111
|
-
} else if (
|
|
8665
|
+
} else if (guard_exports.isEnumValue(args[0], TimeSignatures) && guard_exports.isEnumValueOrUndefined(args[1], BeamGrouping)) {
|
|
8112
8666
|
this.getMeasure().setTimeSignature(new TimeSignature2(args[0], args[1]));
|
|
8113
|
-
} else if (
|
|
8667
|
+
} else if (guard_exports.isIntegerGte(args[0], 1) && guard_exports.isIntegerGte(args[1], 1) && guard_exports.isEnumValueOrUndefined(args[2], BeamGrouping)) {
|
|
8114
8668
|
this.getMeasure().setTimeSignature(new TimeSignature2(args[0], args[1], args[2]));
|
|
8115
8669
|
} else {
|
|
8116
8670
|
assertArg(false);
|
|
@@ -8120,8 +8674,8 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8120
8674
|
setTempo(beatsPerMinute, beatLength, dotted) {
|
|
8121
8675
|
setAssertFunction("setTempo", beatsPerMinute, beatLength, dotted);
|
|
8122
8676
|
assertArg(
|
|
8123
|
-
|
|
8124
|
-
|
|
8677
|
+
guard_exports.isIntegerGte(beatsPerMinute, 1),
|
|
8678
|
+
guard_exports.isUndefined(beatLength) && guard_exports.isUndefined(dotted) || isNoteLength(beatLength) && (guard_exports.isBooleanOrUndefined(dotted) || guard_exports.isIntegerGte(dotted, 0))
|
|
8125
8679
|
);
|
|
8126
8680
|
this.getMeasure().setTempo(beatsPerMinute, beatLength, dotted);
|
|
8127
8681
|
return this;
|
|
@@ -8138,15 +8692,15 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8138
8692
|
setAssertFunction("addNote", voiceId, note, noteLength, noteOptions);
|
|
8139
8693
|
assertArg(
|
|
8140
8694
|
isVoiceId(voiceId),
|
|
8141
|
-
note instanceof Note10 ||
|
|
8695
|
+
note instanceof Note10 || guard_exports.isNonEmptyString(note) || guard_exports.isArray(note) && note.every((note2) => note2 instanceof Note10 || guard_exports.isNonEmptyString(note2)),
|
|
8142
8696
|
isNoteLength(noteLength)
|
|
8143
8697
|
);
|
|
8144
8698
|
noteOptions != null ? noteOptions : noteOptions = {};
|
|
8145
8699
|
assertNoteOptions(noteOptions);
|
|
8146
|
-
if (
|
|
8700
|
+
if (guard_exports.isArray(note)) {
|
|
8147
8701
|
let string = noteOptions.string;
|
|
8148
8702
|
note.forEach((note2, noteId) => {
|
|
8149
|
-
noteOptions.string =
|
|
8703
|
+
noteOptions.string = guard_exports.isArray(string) ? string[noteId] : string;
|
|
8150
8704
|
this.getMeasure().addNoteGroup(voiceId, [note2], noteLength, noteOptions);
|
|
8151
8705
|
});
|
|
8152
8706
|
} else {
|
|
@@ -8166,7 +8720,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8166
8720
|
setAssertFunction("addChord", voiceId, notes, noteLength, noteOptions);
|
|
8167
8721
|
assertArg(
|
|
8168
8722
|
isVoiceId(voiceId),
|
|
8169
|
-
|
|
8723
|
+
guard_exports.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || guard_exports.isNonEmptyString(note)),
|
|
8170
8724
|
isNoteLength(noteLength)
|
|
8171
8725
|
);
|
|
8172
8726
|
noteOptions != null ? noteOptions : noteOptions = {};
|
|
@@ -8211,24 +8765,24 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8211
8765
|
setAssertFunction("addTuplet", voiceId, tupletRatio);
|
|
8212
8766
|
assertArg(
|
|
8213
8767
|
isVoiceId(voiceId),
|
|
8214
|
-
|
|
8215
|
-
isTupletRatio(tupletRatio) &&
|
|
8768
|
+
guard_exports.isFunction(tupletBuilder),
|
|
8769
|
+
isTupletRatio(tupletRatio) && guard_exports.isBooleanOrUndefined(tupletRatio.showRatio)
|
|
8216
8770
|
);
|
|
8217
8771
|
let tupletSymbols = [];
|
|
8218
8772
|
const helper = {
|
|
8219
8773
|
addNote: (note, noteLength, noteOptions) => {
|
|
8220
8774
|
setAssertFunction("addTuplet => addNote", note, noteLength, noteOptions);
|
|
8221
8775
|
assertArg(
|
|
8222
|
-
note instanceof Note10 ||
|
|
8776
|
+
note instanceof Note10 || guard_exports.isNonEmptyString(note) || guard_exports.isArray(note) && note.every((note2) => note2 instanceof Note10 || guard_exports.isNonEmptyString(note2)),
|
|
8223
8777
|
isNoteLength(noteLength)
|
|
8224
8778
|
);
|
|
8225
8779
|
noteOptions != null ? noteOptions : noteOptions = {};
|
|
8226
8780
|
delete noteOptions.triplet;
|
|
8227
8781
|
assertNoteOptions(noteOptions);
|
|
8228
|
-
if (
|
|
8782
|
+
if (guard_exports.isArray(note)) {
|
|
8229
8783
|
let string = noteOptions.string;
|
|
8230
8784
|
note.forEach((note2, noteId) => {
|
|
8231
|
-
noteOptions.string =
|
|
8785
|
+
noteOptions.string = guard_exports.isArray(string) ? string[noteId] : string;
|
|
8232
8786
|
let s = this.getMeasure().addNoteGroup(voiceId, [note2], noteLength, noteOptions, tupletRatio);
|
|
8233
8787
|
tupletSymbols.push(s);
|
|
8234
8788
|
});
|
|
@@ -8241,7 +8795,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8241
8795
|
addChord: (notes, noteLength, noteOptions) => {
|
|
8242
8796
|
setAssertFunction("addTuplet => addChord", notes, noteLength, noteOptions);
|
|
8243
8797
|
assertArg(
|
|
8244
|
-
|
|
8798
|
+
guard_exports.isNonEmptyArray(notes) && notes.every((note) => note instanceof Note10 || guard_exports.isNonEmptyString(note)),
|
|
8245
8799
|
isNoteLength(noteLength)
|
|
8246
8800
|
);
|
|
8247
8801
|
noteOptions != null ? noteOptions : noteOptions = {};
|
|
@@ -8271,8 +8825,8 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8271
8825
|
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
8272
8826
|
assertArg(
|
|
8273
8827
|
isVerseNumber(verse),
|
|
8274
|
-
|
|
8275
|
-
|
|
8828
|
+
guard_exports.isEnumValue(lyricsLength, NoteLength8),
|
|
8829
|
+
guard_exports.isString(lyricsText) || guard_exports.isArray(lyricsText) && lyricsText.every((text) => guard_exports.isString(text))
|
|
8276
8830
|
);
|
|
8277
8831
|
lyricsOptions != null ? lyricsOptions : lyricsOptions = {};
|
|
8278
8832
|
assertLyricsOptions(lyricsOptions);
|
|
@@ -8281,7 +8835,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8281
8835
|
} else {
|
|
8282
8836
|
(_a = lyricsOptions.align) != null ? _a : lyricsOptions.align = this.currentLyricsAlign;
|
|
8283
8837
|
}
|
|
8284
|
-
if (
|
|
8838
|
+
if (guard_exports.isArray(lyricsText)) {
|
|
8285
8839
|
lyricsText.forEach((text) => this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsLength, text, lyricsOptions));
|
|
8286
8840
|
} else {
|
|
8287
8841
|
this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsLength, lyricsText, lyricsOptions);
|
|
@@ -8315,7 +8869,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8315
8869
|
}
|
|
8316
8870
|
addFermataInternal(staffTabOrGroups, fermata) {
|
|
8317
8871
|
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
8318
|
-
assertArg(
|
|
8872
|
+
assertArg(guard_exports.isEnumValue(fermata, Fermata));
|
|
8319
8873
|
this.getMeasure().addFermata(staffTabOrGroups, fermata);
|
|
8320
8874
|
return this;
|
|
8321
8875
|
}
|
|
@@ -8341,7 +8895,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8341
8895
|
addNavigationInternal(staffTabOrGroups, navigation, ...args) {
|
|
8342
8896
|
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
8343
8897
|
assertArg(
|
|
8344
|
-
|
|
8898
|
+
guard_exports.isStrictEqual(navigation, "endRepeat" /* EndRepeat */) && guard_exports.isStrictEqual(args.length, 1) || guard_exports.isStrictEqual(navigation, "ending" /* Ending */) && guard_exports.isIntegerGte(args.length, 1) && args.every((passage) => guard_exports.isIntegerGte(passage, 1)) || guard_exports.isEnumValue(navigation, Navigation) && guard_exports.isEmptyArray(args)
|
|
8345
8899
|
);
|
|
8346
8900
|
this.getMeasure().addNavigation(staffTabOrGroups, navigation, ...args);
|
|
8347
8901
|
return this;
|
|
@@ -8357,12 +8911,12 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8357
8911
|
addAnnotationInternal(staffTabOrGroups, annotation, text) {
|
|
8358
8912
|
annotation != null ? annotation : annotation = getAnnotation(text);
|
|
8359
8913
|
if (annotation === void 0) {
|
|
8360
|
-
throw new
|
|
8914
|
+
throw new MusicError16(MusicErrorType16.Score, `Annotation text "${text}" is not known annotation.`);
|
|
8361
8915
|
}
|
|
8362
8916
|
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
8363
8917
|
assertArg(
|
|
8364
|
-
|
|
8365
|
-
|
|
8918
|
+
guard_exports.isEnumValue(annotation, Annotation),
|
|
8919
|
+
guard_exports.isNonEmptyString(text)
|
|
8366
8920
|
);
|
|
8367
8921
|
this.getMeasure().addAnnotation(staffTabOrGroups, annotation, text);
|
|
8368
8922
|
return this;
|
|
@@ -8386,8 +8940,8 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8386
8940
|
addLabelInternal(staffTabOrGroups, label, text) {
|
|
8387
8941
|
assertStaffTabOrGRoups(staffTabOrGroups);
|
|
8388
8942
|
assertArg(
|
|
8389
|
-
|
|
8390
|
-
|
|
8943
|
+
guard_exports.isEnumValue(label, Label),
|
|
8944
|
+
guard_exports.isNonEmptyString(text)
|
|
8391
8945
|
);
|
|
8392
8946
|
this.getMeasure().addLabel(staffTabOrGroups, label, text);
|
|
8393
8947
|
return this;
|
|
@@ -8415,21 +8969,21 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8415
8969
|
}
|
|
8416
8970
|
addConnective(connective, ...args) {
|
|
8417
8971
|
setAssertFunction("addConnective", connective, ...args);
|
|
8418
|
-
assertArg(
|
|
8972
|
+
assertArg(guard_exports.isEnumValue(connective, Connective));
|
|
8419
8973
|
if (connective === "tie" /* Tie */) {
|
|
8420
|
-
assertArg(
|
|
8421
|
-
assertArg(
|
|
8974
|
+
assertArg(guard_exports.isIntegerOrUndefined(args[0]) || guard_exports.isEnumValue(args[0], TieType));
|
|
8975
|
+
assertArg(guard_exports.isEnumValueOrUndefined(args[1], NoteAnchor));
|
|
8422
8976
|
let tieSpan = args[0];
|
|
8423
8977
|
let noteAnchor = args[1];
|
|
8424
8978
|
this.getMeasure().addConnective(connective, tieSpan, noteAnchor);
|
|
8425
8979
|
} else if (connective === "slur" /* Slur */) {
|
|
8426
|
-
assertArg(
|
|
8427
|
-
assertArg(
|
|
8980
|
+
assertArg(guard_exports.isIntegerOrUndefined(args[0]));
|
|
8981
|
+
assertArg(guard_exports.isEnumValueOrUndefined(args[1], NoteAnchor));
|
|
8428
8982
|
let slurSpan = args[0];
|
|
8429
8983
|
let noteAnchor = args[1];
|
|
8430
8984
|
this.getMeasure().addConnective(connective, slurSpan, noteAnchor);
|
|
8431
8985
|
} else if (connective === "slide" /* Slide */) {
|
|
8432
|
-
assertArg(
|
|
8986
|
+
assertArg(guard_exports.isEnumValueOrUndefined(args[0], NoteAnchor));
|
|
8433
8987
|
let noteAnchor = args[0];
|
|
8434
8988
|
this.getMeasure().addConnective(connective, noteAnchor);
|
|
8435
8989
|
}
|
|
@@ -8449,20 +9003,20 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8449
9003
|
*/
|
|
8450
9004
|
addExtension(extensionBuilder) {
|
|
8451
9005
|
setAssertFunction("addExtension");
|
|
8452
|
-
assertArgMsg(
|
|
9006
|
+
assertArgMsg(guard_exports.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, e.g. addExtension(ext => ext.measures(2)).");
|
|
8453
9007
|
let ticks = 0;
|
|
8454
9008
|
let visible = true;
|
|
8455
9009
|
const helper = {
|
|
8456
9010
|
notes: (noteLength, noteCount) => {
|
|
8457
9011
|
setAssertFunction("addExtension.notes", noteLength, noteCount);
|
|
8458
9012
|
assertArg(isNoteLength(noteLength));
|
|
8459
|
-
assertArg(
|
|
9013
|
+
assertArg(guard_exports.isUndefined(noteCount) || guard_exports.isNumber(noteCount) && noteCount >= 0);
|
|
8460
9014
|
ticks += RhythmProps6.get(noteLength).ticks * (noteCount != null ? noteCount : 1);
|
|
8461
9015
|
return helper;
|
|
8462
9016
|
},
|
|
8463
9017
|
measures: (measureCount) => {
|
|
8464
9018
|
setAssertFunction("addExtension.measures", measureCount);
|
|
8465
|
-
assertArg(
|
|
9019
|
+
assertArg(guard_exports.isNumber(measureCount) && measureCount >= 1);
|
|
8466
9020
|
ticks += this.getMeasure().getMeasureTicks() * measureCount;
|
|
8467
9021
|
return helper;
|
|
8468
9022
|
},
|
|
@@ -8495,9 +9049,9 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8495
9049
|
addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition = "auto" /* Auto */) {
|
|
8496
9050
|
setAssertFunction("addStaffGroup", groupName, staffsTabsAndGroups, verticalPosition);
|
|
8497
9051
|
assertArg(
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
9052
|
+
guard_exports.isNonEmptyString(groupName),
|
|
9053
|
+
guard_exports.isNonEmptyString(staffsTabsAndGroups) || guard_exports.isIntegerGte(staffsTabsAndGroups, 0) || guard_exports.isNonEmptyArray(staffsTabsAndGroups) && staffsTabsAndGroups.every((line) => guard_exports.isNonEmptyString(line) || guard_exports.isIntegerGte(line, 0)),
|
|
9054
|
+
guard_exports.isEnumValue(verticalPosition, VerticalPosition)
|
|
8501
9055
|
);
|
|
8502
9056
|
this.doc.addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition);
|
|
8503
9057
|
return this;
|
|
@@ -8537,7 +9091,7 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8537
9091
|
*/
|
|
8538
9092
|
completeRests(voiceId) {
|
|
8539
9093
|
setAssertFunction("completeRests", voiceId);
|
|
8540
|
-
assertArg(
|
|
9094
|
+
assertArg(guard_exports.isUndefined(voiceId) || isVoiceId(voiceId) || guard_exports.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)));
|
|
8541
9095
|
this.getMeasure().completeRests(voiceId);
|
|
8542
9096
|
return this;
|
|
8543
9097
|
}
|
|
@@ -8551,8 +9105,8 @@ var _DocumentBuilder = class _DocumentBuilder {
|
|
|
8551
9105
|
addScaleArpeggio(scale, bottomNote, numOctaves) {
|
|
8552
9106
|
setAssertFunction("addScaleArpeggio", scale, bottomNote, numOctaves);
|
|
8553
9107
|
assertArg(
|
|
8554
|
-
|
|
8555
|
-
|
|
9108
|
+
guard_exports.isNonEmptyString(bottomNote),
|
|
9109
|
+
guard_exports.isIntegerGte(numOctaves, 1)
|
|
8556
9110
|
);
|
|
8557
9111
|
let ts = this.getMeasure().getTimeSignature();
|
|
8558
9112
|
let notes = scale.getScaleNotes(bottomNote, numOctaves);
|
|
@@ -8571,7 +9125,7 @@ __publicField(_DocumentBuilder, "DefaultMeasureOptions", {});
|
|
|
8571
9125
|
var DocumentBuilder = _DocumentBuilder;
|
|
8572
9126
|
|
|
8573
9127
|
// src/score/pub/event.ts
|
|
8574
|
-
import { MusicError as
|
|
9128
|
+
import { MusicError as MusicError17, MusicErrorType as MusicErrorType17 } from "@tspro/web-music-score/core";
|
|
8575
9129
|
var ScoreEvent = class {
|
|
8576
9130
|
/**
|
|
8577
9131
|
* Create new score event instance.
|
|
@@ -8614,7 +9168,7 @@ var ScoreObjectEvent = class extends ScoreEvent {
|
|
|
8614
9168
|
this.renderContext = renderContext;
|
|
8615
9169
|
this.objects = objects;
|
|
8616
9170
|
if (arguments.length === 0) {
|
|
8617
|
-
throw new
|
|
9171
|
+
throw new MusicError17(MusicErrorType17.Score, "Empty array in score object event!");
|
|
8618
9172
|
}
|
|
8619
9173
|
}
|
|
8620
9174
|
/**
|
|
@@ -8639,21 +9193,19 @@ var ScoreObjectEvent = class extends ScoreEvent {
|
|
|
8639
9193
|
|
|
8640
9194
|
// src/score/pub/music-interface.ts
|
|
8641
9195
|
import * as Audio2 from "@tspro/web-music-score/audio";
|
|
8642
|
-
import { Guard as Guard14, UniMap as UniMap10, ValueSet as ValueSet2, Utils as Utils13 } from "@tspro/ts-utils-lib";
|
|
8643
9196
|
|
|
8644
9197
|
// src/score/pub/music-objects.ts
|
|
8645
|
-
import {
|
|
8646
|
-
import { MusicError as MusicError20, MusicErrorType as MusicErrorType20 } from "@tspro/web-music-score/core";
|
|
9198
|
+
import { MusicError as MusicError18, MusicErrorType as MusicErrorType18 } from "@tspro/web-music-score/core";
|
|
8647
9199
|
function assertArg2(condition, argName, argValue) {
|
|
8648
9200
|
if (!condition) {
|
|
8649
|
-
throw new
|
|
9201
|
+
throw new MusicError18(MusicErrorType18.Score, `Invalid arg: ${argName} = ${argValue}`);
|
|
8650
9202
|
}
|
|
8651
9203
|
}
|
|
8652
9204
|
function getNotationLine(line) {
|
|
8653
9205
|
if (line instanceof ObjStaff || line instanceof ObjTab) {
|
|
8654
9206
|
return line.getMusicInterface();
|
|
8655
9207
|
} else {
|
|
8656
|
-
throw new
|
|
9208
|
+
throw new MusicError18(MusicErrorType18.Score, `Notation line not staff nor tab.`);
|
|
8657
9209
|
}
|
|
8658
9210
|
}
|
|
8659
9211
|
var MusicInterface5 = class {
|
|
@@ -8823,7 +9375,7 @@ var _MDocument = class _MDocument extends MusicInterface5 {
|
|
|
8823
9375
|
* @returns - Player instance.
|
|
8824
9376
|
*/
|
|
8825
9377
|
play(playStateChangeListener) {
|
|
8826
|
-
assertArg2(
|
|
9378
|
+
assertArg2(guard_exports.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
|
|
8827
9379
|
return new MPlayer(this, playStateChangeListener).play();
|
|
8828
9380
|
}
|
|
8829
9381
|
};
|
|
@@ -8853,7 +9405,7 @@ var _MEnding = class _MEnding extends MusicInterface5 {
|
|
|
8853
9405
|
* @returns - Boolean whether this ending has asked passage number.
|
|
8854
9406
|
*/
|
|
8855
9407
|
hasPassage(passage) {
|
|
8856
|
-
assertArg2(
|
|
9408
|
+
assertArg2(guard_exports.isIntegerGte(passage, 1), "passage", passage);
|
|
8857
9409
|
return this.obj.hasPassage(passage);
|
|
8858
9410
|
}
|
|
8859
9411
|
};
|
|
@@ -9005,7 +9557,7 @@ var _MStaffBarLine = class _MStaffBarLine extends MusicInterface5 {
|
|
|
9005
9557
|
if (barLine instanceof ObjBarLineLeft || barLine instanceof ObjBarLineRight) {
|
|
9006
9558
|
return barLine.getMusicInterface();
|
|
9007
9559
|
} else {
|
|
9008
|
-
throw new
|
|
9560
|
+
throw new MusicError18(MusicErrorType18.Score, `Bar line not left nor right.`);
|
|
9009
9561
|
}
|
|
9010
9562
|
}
|
|
9011
9563
|
/**
|
|
@@ -9539,10 +10091,10 @@ __publicField(_MExtensionLine, "Name", "ExtensionLine");
|
|
|
9539
10091
|
var MExtensionLine = _MExtensionLine;
|
|
9540
10092
|
|
|
9541
10093
|
// src/score/pub/music-interface.ts
|
|
9542
|
-
import { MusicError as
|
|
10094
|
+
import { MusicError as MusicError19, MusicErrorType as MusicErrorType19 } from "@tspro/web-music-score/core";
|
|
9543
10095
|
function assertArg3(condition, argName, argValue) {
|
|
9544
10096
|
if (!condition) {
|
|
9545
|
-
throw new
|
|
10097
|
+
throw new MusicError19(MusicErrorType19.Score, `Invalid arg: ${argName} = ${argValue}`);
|
|
9546
10098
|
}
|
|
9547
10099
|
}
|
|
9548
10100
|
function require_t(t, message) {
|
|
@@ -9561,7 +10113,7 @@ var _MPlayer = class _MPlayer {
|
|
|
9561
10113
|
constructor(doc, playStateChangeListener) {
|
|
9562
10114
|
__publicField(this, "player");
|
|
9563
10115
|
assertArg3(doc instanceof MDocument2, "doc", doc);
|
|
9564
|
-
assertArg3(
|
|
10116
|
+
assertArg3(guard_exports.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
|
|
9565
10117
|
this.player = new Player();
|
|
9566
10118
|
this.player.setDocument(doc.getMusicObject());
|
|
9567
10119
|
this.player.setCursorPositionChangeListener((cursorRect) => {
|
|
@@ -9605,7 +10157,7 @@ var _MPlayer = class _MPlayer {
|
|
|
9605
10157
|
return this;
|
|
9606
10158
|
}
|
|
9607
10159
|
};
|
|
9608
|
-
__publicField(_MPlayer, "currentlyPlaying", new
|
|
10160
|
+
__publicField(_MPlayer, "currentlyPlaying", new ValueSet());
|
|
9609
10161
|
var MPlayer = _MPlayer;
|
|
9610
10162
|
var MRenderContext2 = class {
|
|
9611
10163
|
/**
|
|
@@ -9621,7 +10173,7 @@ var MRenderContext2 = class {
|
|
|
9621
10173
|
* @returns - This render context instance.
|
|
9622
10174
|
*/
|
|
9623
10175
|
setDocument(doc) {
|
|
9624
|
-
assertArg3(
|
|
10176
|
+
assertArg3(guard_exports.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
|
|
9625
10177
|
this.ctx.setDocument(doc);
|
|
9626
10178
|
return this;
|
|
9627
10179
|
}
|
|
@@ -9631,7 +10183,7 @@ var MRenderContext2 = class {
|
|
|
9631
10183
|
* @returns - This render context instance.
|
|
9632
10184
|
*/
|
|
9633
10185
|
setCanvas(canvas) {
|
|
9634
|
-
canvas = require_t(
|
|
10186
|
+
canvas = require_t(utils_exports.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set render canvas because invalid canvas id: " + canvas : "Cannot set render canvas because given canvas is undefined.");
|
|
9635
10187
|
this.ctx.setCanvas(canvas);
|
|
9636
10188
|
return this;
|
|
9637
10189
|
}
|
|
@@ -9640,7 +10192,7 @@ var MRenderContext2 = class {
|
|
|
9640
10192
|
* @param scoreEventListener - Score event listener.
|
|
9641
10193
|
*/
|
|
9642
10194
|
setScoreEventListener(scoreEventListener) {
|
|
9643
|
-
assertArg3(
|
|
10195
|
+
assertArg3(guard_exports.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
|
|
9644
10196
|
this.ctx.setScoreEventListener(scoreEventListener);
|
|
9645
10197
|
}
|
|
9646
10198
|
/**
|
|
@@ -9715,7 +10267,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
9715
10267
|
* @returns
|
|
9716
10268
|
*/
|
|
9717
10269
|
setDocument(doc) {
|
|
9718
|
-
assertArg3(
|
|
10270
|
+
assertArg3(guard_exports.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
|
|
9719
10271
|
this.onStop();
|
|
9720
10272
|
if (doc) {
|
|
9721
10273
|
this.player = new MPlayer(doc, (playState) => {
|
|
@@ -9759,9 +10311,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
9759
10311
|
* @returns - This playback buttons class instance.
|
|
9760
10312
|
*/
|
|
9761
10313
|
setPlayButton(btn, btnLabel) {
|
|
9762
|
-
assertArg3(
|
|
10314
|
+
assertArg3(guard_exports.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
|
|
9763
10315
|
_MPlaybackButtons.removeOnClickListeners(this.playButton, this.onPlay);
|
|
9764
|
-
this.playButton = require_t(
|
|
10316
|
+
this.playButton = require_t(utils_exports.Dom.getButton(btn), "Play button required!");
|
|
9765
10317
|
this.playLabel = btnLabel != null ? btnLabel : "Play";
|
|
9766
10318
|
_MPlaybackButtons.removeOnClickListeners(this.playButton, "all");
|
|
9767
10319
|
_MPlaybackButtons.addOnClickListener(this.playButton, this.onPlay);
|
|
@@ -9775,9 +10327,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
9775
10327
|
* @returns - This playback buttons class instance.
|
|
9776
10328
|
*/
|
|
9777
10329
|
setStopButton(btn, btnLabel) {
|
|
9778
|
-
assertArg3(
|
|
10330
|
+
assertArg3(guard_exports.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
|
|
9779
10331
|
_MPlaybackButtons.removeOnClickListeners(this.stopButton, this.onStop);
|
|
9780
|
-
this.stopButton = require_t(
|
|
10332
|
+
this.stopButton = require_t(utils_exports.Dom.getButton(btn), "Stop button required!");
|
|
9781
10333
|
this.stopLabel = btnLabel != null ? btnLabel : "Stop";
|
|
9782
10334
|
_MPlaybackButtons.removeOnClickListeners(this.stopButton, "all");
|
|
9783
10335
|
_MPlaybackButtons.addOnClickListener(this.stopButton, this.onStop);
|
|
@@ -9792,10 +10344,10 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
9792
10344
|
* @returns - This playback buttons class instance.
|
|
9793
10345
|
*/
|
|
9794
10346
|
setPlayStopButton(btn, playLabel, stopLabel) {
|
|
9795
|
-
assertArg3(
|
|
9796
|
-
assertArg3(
|
|
10347
|
+
assertArg3(guard_exports.isStringOrUndefined(playLabel), "playLabel", playLabel);
|
|
10348
|
+
assertArg3(guard_exports.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
|
|
9797
10349
|
_MPlaybackButtons.removeOnClickListeners(this.playStopButton, this.onPlayStop);
|
|
9798
|
-
this.playStopButton = require_t(
|
|
10350
|
+
this.playStopButton = require_t(utils_exports.Dom.getButton(btn), "Play/stop button required!");
|
|
9799
10351
|
this.playLabel = playLabel != null ? playLabel : "Play";
|
|
9800
10352
|
this.stopLabel = stopLabel != null ? stopLabel : "Stop";
|
|
9801
10353
|
_MPlaybackButtons.removeOnClickListeners(this.playStopButton, "all");
|
|
@@ -9810,9 +10362,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
9810
10362
|
* @returns - This playback buttons class instance.
|
|
9811
10363
|
*/
|
|
9812
10364
|
setPauseButton(btn, btnLabel) {
|
|
9813
|
-
assertArg3(
|
|
10365
|
+
assertArg3(guard_exports.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
|
|
9814
10366
|
_MPlaybackButtons.removeOnClickListeners(this.pauseButton, this.onPause);
|
|
9815
|
-
this.pauseButton = require_t(
|
|
10367
|
+
this.pauseButton = require_t(utils_exports.Dom.getButton(btn), "Pause button required!");
|
|
9816
10368
|
this.pauseLabel = btnLabel != null ? btnLabel : "Pause";
|
|
9817
10369
|
_MPlaybackButtons.removeOnClickListeners(this.pauseButton, "all");
|
|
9818
10370
|
_MPlaybackButtons.addOnClickListener(this.pauseButton, this.onPause);
|
|
@@ -9833,12 +10385,12 @@ var _MPlaybackButtons = class _MPlaybackButtons {
|
|
|
9833
10385
|
this.savedOnClickListeners.set(btn, curListeners);
|
|
9834
10386
|
}
|
|
9835
10387
|
static addOnClickListener(btn, onClickListener) {
|
|
9836
|
-
assertArg3(
|
|
10388
|
+
assertArg3(guard_exports.isFunction(onClickListener), "onClick", onClickListener);
|
|
9837
10389
|
btn.addEventListener("click", onClickListener);
|
|
9838
10390
|
this.savedOnClickListeners.getOrCreate(btn, []).push(onClickListener);
|
|
9839
10391
|
}
|
|
9840
10392
|
};
|
|
9841
|
-
__publicField(_MPlaybackButtons, "savedOnClickListeners", new
|
|
10393
|
+
__publicField(_MPlaybackButtons, "savedOnClickListeners", new UniMap());
|
|
9842
10394
|
var MPlaybackButtons = _MPlaybackButtons;
|
|
9843
10395
|
|
|
9844
10396
|
// src/score/index.ts
|
|
@@ -9909,6 +10461,7 @@ export {
|
|
|
9909
10461
|
isStringNumber,
|
|
9910
10462
|
isVerseNumber,
|
|
9911
10463
|
isVoiceId,
|
|
10464
|
+
setColor,
|
|
9912
10465
|
validateStringNumber,
|
|
9913
10466
|
validateVerseNumber,
|
|
9914
10467
|
validateVoiceId
|