vexflow 4.0.1-beta.0 → 4.0.1-beta.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.
Files changed (328) hide show
  1. package/build/cjs/vexflow-bravura.js +2 -2
  2. package/build/cjs/vexflow-bravura.js.map +1 -1
  3. package/build/cjs/vexflow-core.js +2 -2
  4. package/build/cjs/vexflow-core.js.map +1 -1
  5. package/build/cjs/vexflow-debug-with-tests.js +126 -26
  6. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  7. package/build/cjs/vexflow-debug.js +94 -26
  8. package/build/cjs/vexflow-debug.js.map +1 -1
  9. package/build/cjs/vexflow-gonville.js +2 -2
  10. package/build/cjs/vexflow-gonville.js.map +1 -1
  11. package/build/cjs/vexflow-petaluma.js +2 -2
  12. package/build/cjs/vexflow-petaluma.js.map +1 -1
  13. package/build/cjs/vexflow.js +2 -2
  14. package/build/cjs/vexflow.js.map +1 -1
  15. package/build/esm/src/version.js +3 -3
  16. package/package.json +1 -1
  17. package/src/note.ts +2 -2
  18. package/src/stavenote.ts +80 -16
  19. package/build/esm/entry/vexflow-bravura.js +0 -11
  20. package/build/esm/entry/vexflow-core.js +0 -54
  21. package/build/esm/entry/vexflow-debug-with-tests.js +0 -4
  22. package/build/esm/entry/vexflow-debug.js +0 -3
  23. package/build/esm/entry/vexflow-font-bravura.js +0 -7
  24. package/build/esm/entry/vexflow-font-custom.js +0 -7
  25. package/build/esm/entry/vexflow-font-gonville.js +0 -7
  26. package/build/esm/entry/vexflow-font-petaluma.js +0 -7
  27. package/build/esm/entry/vexflow-gonville.js +0 -11
  28. package/build/esm/entry/vexflow-petaluma.js +0 -11
  29. package/build/esm/entry/vexflow.js +0 -9
  30. package/build/esm/src/accidental.js +0 -348
  31. package/build/esm/src/annotation.js +0 -213
  32. package/build/esm/src/articulation.js +0 -264
  33. package/build/esm/src/barnote.js +0 -58
  34. package/build/esm/src/beam.js +0 -632
  35. package/build/esm/src/bend.js +0 -202
  36. package/build/esm/src/boundingbox.js +0 -59
  37. package/build/esm/src/boundingboxcomputation.js +0 -107
  38. package/build/esm/src/canvascontext.js +0 -202
  39. package/build/esm/src/chordsymbol.js +0 -578
  40. package/build/esm/src/clef.js +0 -153
  41. package/build/esm/src/clefnote.js +0 -65
  42. package/build/esm/src/crescendo.js +0 -77
  43. package/build/esm/src/curve.js +0 -118
  44. package/build/esm/src/dot.js +0 -137
  45. package/build/esm/src/easyscore.js +0 -374
  46. package/build/esm/src/element.js +0 -216
  47. package/build/esm/src/factory.js +0 -440
  48. package/build/esm/src/flow.js +0 -275
  49. package/build/esm/src/font.js +0 -264
  50. package/build/esm/src/fonts/bravura_glyphs.js +0 -3239
  51. package/build/esm/src/fonts/bravura_metrics.js +0 -507
  52. package/build/esm/src/fonts/custom_glyphs.js +0 -78
  53. package/build/esm/src/fonts/custom_metrics.js +0 -5
  54. package/build/esm/src/fonts/gonville_glyphs.js +0 -828
  55. package/build/esm/src/fonts/gonville_metrics.js +0 -421
  56. package/build/esm/src/fonts/load_all.js +0 -10
  57. package/build/esm/src/fonts/load_bravura.js +0 -6
  58. package/build/esm/src/fonts/load_custom.js +0 -6
  59. package/build/esm/src/fonts/load_gonville.js +0 -6
  60. package/build/esm/src/fonts/load_petaluma.js +0 -6
  61. package/build/esm/src/fonts/petaluma_glyphs.js +0 -1335
  62. package/build/esm/src/fonts/petaluma_metrics.js +0 -536
  63. package/build/esm/src/fonts/petalumascript_glyphs.js +0 -863
  64. package/build/esm/src/fonts/robotoslab_glyphs.js +0 -863
  65. package/build/esm/src/fonts/textfonts.js +0 -44
  66. package/build/esm/src/formatter.js +0 -568
  67. package/build/esm/src/fraction.js +0 -171
  68. package/build/esm/src/frethandfinger.js +0 -156
  69. package/build/esm/src/ghostnote.js +0 -50
  70. package/build/esm/src/glyph.js +0 -331
  71. package/build/esm/src/glyphnote.js +0 -55
  72. package/build/esm/src/gracenote.js +0 -133
  73. package/build/esm/src/gracenotegroup.js +0 -128
  74. package/build/esm/src/gracetabnote.js +0 -12
  75. package/build/esm/src/index.js +0 -91
  76. package/build/esm/src/keymanager.js +0 -99
  77. package/build/esm/src/keysignature.js +0 -250
  78. package/build/esm/src/keysignote.js +0 -28
  79. package/build/esm/src/modifier.js +0 -128
  80. package/build/esm/src/modifiercontext.js +0 -110
  81. package/build/esm/src/multimeasurerest.js +0 -173
  82. package/build/esm/src/music.js +0 -322
  83. package/build/esm/src/note.js +0 -371
  84. package/build/esm/src/notehead.js +0 -169
  85. package/build/esm/src/notesubgroup.js +0 -59
  86. package/build/esm/src/ornament.js +0 -206
  87. package/build/esm/src/parenthesis.js +0 -76
  88. package/build/esm/src/parser.js +0 -164
  89. package/build/esm/src/pedalmarking.js +0 -192
  90. package/build/esm/src/registry.js +0 -81
  91. package/build/esm/src/rendercontext.js +0 -24
  92. package/build/esm/src/renderer.js +0 -112
  93. package/build/esm/src/repeatnote.js +0 -22
  94. package/build/esm/src/stave.js +0 -547
  95. package/build/esm/src/stavebarline.js +0 -182
  96. package/build/esm/src/staveconnector.js +0 -196
  97. package/build/esm/src/stavehairpin.js +0 -120
  98. package/build/esm/src/staveline.js +0 -218
  99. package/build/esm/src/stavemodifier.js +0 -77
  100. package/build/esm/src/stavenote.js +0 -799
  101. package/build/esm/src/staverepetition.js +0 -155
  102. package/build/esm/src/stavesection.js +0 -58
  103. package/build/esm/src/stavetempo.js +0 -91
  104. package/build/esm/src/stavetext.js +0 -82
  105. package/build/esm/src/stavetie.js +0 -141
  106. package/build/esm/src/stavevolta.js +0 -67
  107. package/build/esm/src/stem.js +0 -131
  108. package/build/esm/src/stemmablenote.js +0 -193
  109. package/build/esm/src/stringnumber.js +0 -231
  110. package/build/esm/src/strokes.js +0 -200
  111. package/build/esm/src/svgcontext.js +0 -414
  112. package/build/esm/src/system.js +0 -116
  113. package/build/esm/src/tables.js +0 -1102
  114. package/build/esm/src/tabnote.js +0 -299
  115. package/build/esm/src/tabslide.js +0 -76
  116. package/build/esm/src/tabstave.js +0 -17
  117. package/build/esm/src/tabtie.js +0 -19
  118. package/build/esm/src/textbracket.js +0 -144
  119. package/build/esm/src/textdynamics.js +0 -81
  120. package/build/esm/src/textformatter.js +0 -177
  121. package/build/esm/src/textnote.js +0 -176
  122. package/build/esm/src/tickable.js +0 -214
  123. package/build/esm/src/tickcontext.js +0 -170
  124. package/build/esm/src/timesigglyph.js +0 -85
  125. package/build/esm/src/timesignature.js +0 -89
  126. package/build/esm/src/timesignote.js +0 -32
  127. package/build/esm/src/tremolo.js +0 -47
  128. package/build/esm/src/tuning.js +0 -54
  129. package/build/esm/src/tuplet.js +0 -240
  130. package/build/esm/src/typeguard.js +0 -30
  131. package/build/esm/src/util.js +0 -58
  132. package/build/esm/src/vex.js +0 -51
  133. package/build/esm/src/vibrato.js +0 -100
  134. package/build/esm/src/vibratobracket.js +0 -50
  135. package/build/esm/src/voice.js +0 -187
  136. package/build/esm/src/web.js +0 -15
  137. package/build/esm/tests/accidental_tests.js +0 -974
  138. package/build/esm/tests/annotation_tests.js +0 -377
  139. package/build/esm/tests/articulation_tests.js +0 -365
  140. package/build/esm/tests/auto_beam_formatting_tests.js +0 -548
  141. package/build/esm/tests/bach_tests.js +0 -335
  142. package/build/esm/tests/barline_tests.js +0 -52
  143. package/build/esm/tests/beam_tests.js +0 -595
  144. package/build/esm/tests/bend_tests.js +0 -215
  145. package/build/esm/tests/boundingbox_tests.js +0 -53
  146. package/build/esm/tests/boundingboxcomputation_tests.js +0 -183
  147. package/build/esm/tests/chordsymbol_tests.js +0 -320
  148. package/build/esm/tests/clef_tests.js +0 -131
  149. package/build/esm/tests/curve_tests.js +0 -118
  150. package/build/esm/tests/dot_tests.js +0 -123
  151. package/build/esm/tests/easyscore_tests.js +0 -459
  152. package/build/esm/tests/factory_tests.js +0 -44
  153. package/build/esm/tests/font_tests.js +0 -135
  154. package/build/esm/tests/formatter/framestack.js +0 -61
  155. package/build/esm/tests/formatter/tests.js +0 -203
  156. package/build/esm/tests/formatter_tests.js +0 -669
  157. package/build/esm/tests/fraction_tests.js +0 -72
  158. package/build/esm/tests/ghostnote_tests.js +0 -77
  159. package/build/esm/tests/glyphnote_tests.js +0 -113
  160. package/build/esm/tests/gracenote_tests.js +0 -370
  161. package/build/esm/tests/gracetabnote_tests.js +0 -79
  162. package/build/esm/tests/index.js +0 -68
  163. package/build/esm/tests/key_clef_tests.js +0 -103
  164. package/build/esm/tests/keymanager_tests.js +0 -68
  165. package/build/esm/tests/keysignature_tests.js +0 -308
  166. package/build/esm/tests/mocks.js +0 -71
  167. package/build/esm/tests/modifier_tests.js +0 -24
  168. package/build/esm/tests/multimeasurerest_tests.js +0 -141
  169. package/build/esm/tests/music_tests.js +0 -161
  170. package/build/esm/tests/notehead_tests.js +0 -137
  171. package/build/esm/tests/notesubgroup_tests.js +0 -149
  172. package/build/esm/tests/offscreencanvas_tests.js +0 -47
  173. package/build/esm/tests/ornament_tests.js +0 -298
  174. package/build/esm/tests/parser_tests.js +0 -122
  175. package/build/esm/tests/pedalmarking_tests.js +0 -64
  176. package/build/esm/tests/percussion_tests.js +0 -180
  177. package/build/esm/tests/registry_tests.js +0 -64
  178. package/build/esm/tests/renderer_tests.js +0 -113
  179. package/build/esm/tests/rests_tests.js +0 -248
  180. package/build/esm/tests/rhythm_tests.js +0 -357
  181. package/build/esm/tests/stave_tests.js +0 -560
  182. package/build/esm/tests/staveconnector_tests.js +0 -402
  183. package/build/esm/tests/stavehairpin_tests.js +0 -90
  184. package/build/esm/tests/staveline_tests.js +0 -122
  185. package/build/esm/tests/stavemodifier_tests.js +0 -51
  186. package/build/esm/tests/stavenote_tests.js +0 -835
  187. package/build/esm/tests/stavetie_tests.js +0 -108
  188. package/build/esm/tests/stringnumber_tests.js +0 -259
  189. package/build/esm/tests/strokes_tests.js +0 -275
  190. package/build/esm/tests/style_tests.js +0 -98
  191. package/build/esm/tests/support/qunit.js +0 -2765
  192. package/build/esm/tests/tabnote_tests.js +0 -474
  193. package/build/esm/tests/tabslide_tests.js +0 -135
  194. package/build/esm/tests/tabstave_tests.js +0 -23
  195. package/build/esm/tests/tabtie_tests.js +0 -173
  196. package/build/esm/tests/textbracket_tests.js +0 -100
  197. package/build/esm/tests/textformatter_tests.js +0 -24
  198. package/build/esm/tests/textnote_tests.js +0 -215
  199. package/build/esm/tests/threevoice_tests.js +0 -132
  200. package/build/esm/tests/tickcontext_tests.js +0 -36
  201. package/build/esm/tests/timesignature_tests.js +0 -134
  202. package/build/esm/tests/tremolo_tests.js +0 -75
  203. package/build/esm/tests/tuning_tests.js +0 -56
  204. package/build/esm/tests/tuplet_tests.js +0 -450
  205. package/build/esm/tests/typeguard_tests.js +0 -82
  206. package/build/esm/tests/vexflow_test_helpers.js +0 -266
  207. package/build/esm/tests/vf_prefix_tests.js +0 -115
  208. package/build/esm/tests/vibrato_tests.js +0 -92
  209. package/build/esm/tests/vibratobracket_tests.js +0 -45
  210. package/build/esm/tests/voice_tests.js +0 -69
  211. package/build/types/entry/vexflow-bravura.d.ts +0 -3
  212. package/build/types/entry/vexflow-core.d.ts +0 -3
  213. package/build/types/entry/vexflow-debug.d.ts +0 -3
  214. package/build/types/entry/vexflow-font-bravura.d.ts +0 -3771
  215. package/build/types/entry/vexflow-font-custom.d.ts +0 -86
  216. package/build/types/entry/vexflow-font-gonville.d.ts +0 -1267
  217. package/build/types/entry/vexflow-font-petaluma.d.ts +0 -1896
  218. package/build/types/entry/vexflow-gonville.d.ts +0 -3
  219. package/build/types/entry/vexflow-petaluma.d.ts +0 -3
  220. package/build/types/entry/vexflow.d.ts +0 -3
  221. package/build/types/src/accidental.d.ts +0 -66
  222. package/build/types/src/annotation.d.ts +0 -60
  223. package/build/types/src/articulation.d.ts +0 -62
  224. package/build/types/src/barnote.d.ts +0 -29
  225. package/build/types/src/beam.d.ts +0 -124
  226. package/build/types/src/bend.d.ts +0 -73
  227. package/build/types/src/boundingbox.d.ts +0 -42
  228. package/build/types/src/boundingboxcomputation.d.ts +0 -33
  229. package/build/types/src/canvascontext.d.ts +0 -89
  230. package/build/types/src/chordsymbol.d.ts +0 -149
  231. package/build/types/src/clef.d.ts +0 -48
  232. package/build/types/src/clefnote.d.ts +0 -25
  233. package/build/types/src/crescendo.d.ts +0 -27
  234. package/build/types/src/curve.d.ts +0 -41
  235. package/build/types/src/dot.d.ts +0 -20
  236. package/build/types/src/easyscore.d.ts +0 -148
  237. package/build/types/src/element.d.ts +0 -202
  238. package/build/types/src/factory.d.ts +0 -271
  239. package/build/types/src/flow.d.ts +0 -245
  240. package/build/types/src/font.d.ts +0 -181
  241. package/build/types/src/fonts/bravura_glyphs.d.ts +0 -3239
  242. package/build/types/src/fonts/bravura_metrics.d.ts +0 -533
  243. package/build/types/src/fonts/custom_glyphs.d.ts +0 -78
  244. package/build/types/src/fonts/custom_metrics.d.ts +0 -5
  245. package/build/types/src/fonts/gonville_glyphs.d.ts +0 -828
  246. package/build/types/src/fonts/gonville_metrics.d.ts +0 -440
  247. package/build/types/src/fonts/load_all.d.ts +0 -1
  248. package/build/types/src/fonts/load_bravura.d.ts +0 -1
  249. package/build/types/src/fonts/load_custom.d.ts +0 -1
  250. package/build/types/src/fonts/load_gonville.d.ts +0 -1
  251. package/build/types/src/fonts/load_petaluma.d.ts +0 -1
  252. package/build/types/src/fonts/petaluma_glyphs.d.ts +0 -1335
  253. package/build/types/src/fonts/petaluma_metrics.d.ts +0 -562
  254. package/build/types/src/fonts/petalumascript_glyphs.d.ts +0 -863
  255. package/build/types/src/fonts/robotoslab_glyphs.d.ts +0 -863
  256. package/build/types/src/fonts/textfonts.d.ts +0 -1
  257. package/build/types/src/formatter.d.ts +0 -203
  258. package/build/types/src/fraction.d.ts +0 -62
  259. package/build/types/src/frethandfinger.d.ts +0 -22
  260. package/build/types/src/ghostnote.d.ts +0 -16
  261. package/build/types/src/glyph.d.ts +0 -139
  262. package/build/types/src/glyphnote.d.ts +0 -17
  263. package/build/types/src/gracenote.d.ts +0 -19
  264. package/build/types/src/gracenotegroup.d.ts +0 -33
  265. package/build/types/src/gracetabnote.d.ts +0 -5
  266. package/build/types/src/index.d.ts +0 -91
  267. package/build/types/src/keymanager.d.ts +0 -25
  268. package/build/types/src/keysignature.d.ts +0 -50
  269. package/build/types/src/keysignote.d.ts +0 -11
  270. package/build/types/src/modifier.d.ts +0 -97
  271. package/build/types/src/modifiercontext.d.ts +0 -45
  272. package/build/types/src/multimeasurerest.d.ts +0 -61
  273. package/build/types/src/music.d.ts +0 -91
  274. package/build/types/src/note.d.ts +0 -230
  275. package/build/types/src/notehead.d.ts +0 -70
  276. package/build/types/src/notesubgroup.d.ts +0 -18
  277. package/build/types/src/ornament.d.ts +0 -76
  278. package/build/types/src/parenthesis.d.ts +0 -22
  279. package/build/types/src/parser.d.ts +0 -45
  280. package/build/types/src/pedalmarking.d.ts +0 -69
  281. package/build/types/src/registry.d.ts +0 -40
  282. package/build/types/src/rendercontext.d.ts +0 -64
  283. package/build/types/src/renderer.d.ts +0 -35
  284. package/build/types/src/repeatnote.d.ts +0 -6
  285. package/build/types/src/stave.d.ts +0 -186
  286. package/build/types/src/stavebarline.d.ts +0 -28
  287. package/build/types/src/staveconnector.d.ts +0 -67
  288. package/build/types/src/stavehairpin.d.ts +0 -56
  289. package/build/types/src/staveline.d.ts +0 -57
  290. package/build/types/src/stavemodifier.d.ts +0 -44
  291. package/build/types/src/stavenote.d.ts +0 -154
  292. package/build/types/src/staverepetition.d.ts +0 -32
  293. package/build/types/src/stavesection.d.ts +0 -15
  294. package/build/types/src/stavetempo.d.ts +0 -25
  295. package/build/types/src/stavetext.d.ts +0 -25
  296. package/build/types/src/stavetie.d.ts +0 -59
  297. package/build/types/src/stavevolta.d.ts +0 -21
  298. package/build/types/src/stem.d.ts +0 -58
  299. package/build/types/src/stemmablenote.d.ts +0 -39
  300. package/build/types/src/stringnumber.d.ts +0 -27
  301. package/build/types/src/strokes.d.ts +0 -33
  302. package/build/types/src/svgcontext.d.ts +0 -131
  303. package/build/types/src/system.d.ts +0 -92
  304. package/build/types/src/tables.d.ts +0 -96
  305. package/build/types/src/tabnote.d.ts +0 -44
  306. package/build/types/src/tabslide.d.ts +0 -34
  307. package/build/types/src/tabstave.d.ts +0 -7
  308. package/build/types/src/tabtie.d.ts +0 -18
  309. package/build/types/src/textbracket.d.ts +0 -55
  310. package/build/types/src/textdynamics.d.ts +0 -39
  311. package/build/types/src/textformatter.d.ts +0 -109
  312. package/build/types/src/textnote.d.ts +0 -49
  313. package/build/types/src/tickable.d.ts +0 -140
  314. package/build/types/src/tickcontext.d.ts +0 -82
  315. package/build/types/src/timesigglyph.d.ts +0 -14
  316. package/build/types/src/timesignature.d.ts +0 -26
  317. package/build/types/src/timesignote.d.ts +0 -11
  318. package/build/types/src/tremolo.d.ts +0 -17
  319. package/build/types/src/tuning.d.ts +0 -23
  320. package/build/types/src/tuplet.d.ts +0 -105
  321. package/build/types/src/typeguard.d.ts +0 -99
  322. package/build/types/src/util.d.ts +0 -27
  323. package/build/types/src/version.d.ts +0 -3
  324. package/build/types/src/vex.d.ts +0 -18
  325. package/build/types/src/vibrato.d.ts +0 -29
  326. package/build/types/src/vibratobracket.d.ts +0 -33
  327. package/build/types/src/voice.d.ts +0 -108
  328. package/build/types/src/web.d.ts +0 -2
@@ -1,182 +0,0 @@
1
- import { StaveModifier, StaveModifierPosition } from './stavemodifier.js';
2
- import { Tables } from './tables.js';
3
- export var BarlineType;
4
- (function (BarlineType) {
5
- BarlineType[BarlineType["SINGLE"] = 1] = "SINGLE";
6
- BarlineType[BarlineType["DOUBLE"] = 2] = "DOUBLE";
7
- BarlineType[BarlineType["END"] = 3] = "END";
8
- BarlineType[BarlineType["REPEAT_BEGIN"] = 4] = "REPEAT_BEGIN";
9
- BarlineType[BarlineType["REPEAT_END"] = 5] = "REPEAT_END";
10
- BarlineType[BarlineType["REPEAT_BOTH"] = 6] = "REPEAT_BOTH";
11
- BarlineType[BarlineType["NONE"] = 7] = "NONE";
12
- })(BarlineType || (BarlineType = {}));
13
- export class Barline extends StaveModifier {
14
- constructor(type) {
15
- super();
16
- this.thickness = Tables.STAVE_LINE_THICKNESS;
17
- const TYPE = BarlineType;
18
- this.widths = {};
19
- this.widths[TYPE.SINGLE] = 5;
20
- this.widths[TYPE.DOUBLE] = 5;
21
- this.widths[TYPE.END] = 5;
22
- this.widths[TYPE.REPEAT_BEGIN] = 5;
23
- this.widths[TYPE.REPEAT_END] = 5;
24
- this.widths[TYPE.REPEAT_BOTH] = 5;
25
- this.widths[TYPE.NONE] = 5;
26
- this.paddings = {};
27
- this.paddings[TYPE.SINGLE] = 0;
28
- this.paddings[TYPE.DOUBLE] = 0;
29
- this.paddings[TYPE.END] = 0;
30
- this.paddings[TYPE.REPEAT_BEGIN] = 15;
31
- this.paddings[TYPE.REPEAT_END] = 15;
32
- this.paddings[TYPE.REPEAT_BOTH] = 15;
33
- this.paddings[TYPE.NONE] = 0;
34
- this.layoutMetricsMap = {};
35
- this.layoutMetricsMap[TYPE.SINGLE] = {
36
- xMin: 0,
37
- xMax: 1,
38
- paddingLeft: 5,
39
- paddingRight: 5,
40
- };
41
- this.layoutMetricsMap[TYPE.DOUBLE] = {
42
- xMin: -3,
43
- xMax: 1,
44
- paddingLeft: 5,
45
- paddingRight: 5,
46
- };
47
- this.layoutMetricsMap[TYPE.END] = {
48
- xMin: -5,
49
- xMax: 1,
50
- paddingLeft: 5,
51
- paddingRight: 5,
52
- };
53
- this.layoutMetricsMap[TYPE.REPEAT_END] = {
54
- xMin: -10,
55
- xMax: 1,
56
- paddingLeft: 5,
57
- paddingRight: 5,
58
- };
59
- this.layoutMetricsMap[TYPE.REPEAT_BEGIN] = {
60
- xMin: -2,
61
- xMax: 10,
62
- paddingLeft: 5,
63
- paddingRight: 5,
64
- };
65
- this.layoutMetricsMap[TYPE.REPEAT_BOTH] = {
66
- xMin: -10,
67
- xMax: 10,
68
- paddingLeft: 5,
69
- paddingRight: 5,
70
- };
71
- this.layoutMetricsMap[TYPE.NONE] = {
72
- xMin: 0,
73
- xMax: 0,
74
- paddingLeft: 5,
75
- paddingRight: 5,
76
- };
77
- this.setPosition(StaveModifierPosition.BEGIN);
78
- this.setType(type);
79
- }
80
- static get CATEGORY() {
81
- return "Barline";
82
- }
83
- static get type() {
84
- return BarlineType;
85
- }
86
- static get typeString() {
87
- return {
88
- single: BarlineType.SINGLE,
89
- double: BarlineType.DOUBLE,
90
- end: BarlineType.END,
91
- repeatBegin: BarlineType.REPEAT_BEGIN,
92
- repeatEnd: BarlineType.REPEAT_END,
93
- repeatBoth: BarlineType.REPEAT_BOTH,
94
- none: BarlineType.NONE,
95
- };
96
- }
97
- getType() {
98
- return this.type;
99
- }
100
- setType(type) {
101
- this.type = typeof type === 'string' ? Barline.typeString[type] : type;
102
- this.setWidth(this.widths[this.type]);
103
- this.setPadding(this.paddings[this.type]);
104
- this.setLayoutMetrics(this.layoutMetricsMap[this.type]);
105
- return this;
106
- }
107
- draw(stave) {
108
- stave.checkContext();
109
- this.setRendered();
110
- switch (this.type) {
111
- case BarlineType.SINGLE:
112
- this.drawVerticalBar(stave, this.x, false);
113
- break;
114
- case BarlineType.DOUBLE:
115
- this.drawVerticalBar(stave, this.x, true);
116
- break;
117
- case BarlineType.END:
118
- this.drawVerticalEndBar(stave, this.x);
119
- break;
120
- case BarlineType.REPEAT_BEGIN:
121
- this.drawRepeatBar(stave, this.x, true);
122
- if (stave.getX() !== this.x) {
123
- this.drawVerticalBar(stave, stave.getX());
124
- }
125
- break;
126
- case BarlineType.REPEAT_END:
127
- this.drawRepeatBar(stave, this.x, false);
128
- break;
129
- case BarlineType.REPEAT_BOTH:
130
- this.drawRepeatBar(stave, this.x, false);
131
- this.drawRepeatBar(stave, this.x, true);
132
- break;
133
- default:
134
- break;
135
- }
136
- }
137
- drawVerticalBar(stave, x, double_bar) {
138
- const staveCtx = stave.checkContext();
139
- const topY = stave.getTopLineTopY();
140
- const botY = stave.getBottomLineBottomY();
141
- if (double_bar) {
142
- staveCtx.fillRect(x - 3, topY, 1, botY - topY);
143
- }
144
- staveCtx.fillRect(x, topY, 1, botY - topY);
145
- }
146
- drawVerticalEndBar(stave, x) {
147
- const staveCtx = stave.checkContext();
148
- const topY = stave.getTopLineTopY();
149
- const botY = stave.getBottomLineBottomY();
150
- staveCtx.fillRect(x - 5, topY, 1, botY - topY);
151
- staveCtx.fillRect(x - 2, topY, 3, botY - topY);
152
- }
153
- drawRepeatBar(stave, x, begin) {
154
- const staveCtx = stave.checkContext();
155
- const topY = stave.getTopLineTopY();
156
- const botY = stave.getBottomLineBottomY();
157
- let x_shift = 3;
158
- if (!begin) {
159
- x_shift = -5;
160
- }
161
- staveCtx.fillRect(x + x_shift, topY, 1, botY - topY);
162
- staveCtx.fillRect(x - 2, topY, 3, botY - topY);
163
- const dot_radius = 2;
164
- if (begin) {
165
- x_shift += 4;
166
- }
167
- else {
168
- x_shift -= 4;
169
- }
170
- const dot_x = x + x_shift + dot_radius / 2;
171
- let y_offset = (stave.getNumLines() - 1) * stave.getSpacingBetweenLines();
172
- y_offset = y_offset / 2 - stave.getSpacingBetweenLines() / 2;
173
- let dot_y = topY + y_offset + dot_radius / 2;
174
- staveCtx.beginPath();
175
- staveCtx.arc(dot_x, dot_y, dot_radius, 0, Math.PI * 2, false);
176
- staveCtx.fill();
177
- dot_y += stave.getSpacingBetweenLines();
178
- staveCtx.beginPath();
179
- staveCtx.arc(dot_x, dot_y, dot_radius, 0, Math.PI * 2, false);
180
- staveCtx.fill();
181
- }
182
- }
@@ -1,196 +0,0 @@
1
- import { Element } from './element.js';
2
- import { Font, FontStyle, FontWeight } from './font.js';
3
- import { Glyph } from './glyph.js';
4
- import { Tables } from './tables.js';
5
- import { RuntimeError } from './util.js';
6
- function drawBoldDoubleLine(ctx, type, topX, topY, botY) {
7
- if (type !== StaveConnector.type.BOLD_DOUBLE_LEFT && type !== StaveConnector.type.BOLD_DOUBLE_RIGHT) {
8
- throw new RuntimeError('InvalidConnector', 'A REPEAT_BEGIN or REPEAT_END type must be provided.');
9
- }
10
- let x_shift = 3;
11
- let variableWidth = 3.5;
12
- const thickLineOffset = 2;
13
- if (type === StaveConnector.type.BOLD_DOUBLE_RIGHT) {
14
- x_shift = -5;
15
- variableWidth = 3;
16
- }
17
- ctx.fillRect(topX + x_shift, topY, 1, botY - topY);
18
- ctx.fillRect(topX - thickLineOffset, topY, variableWidth, botY - topY);
19
- }
20
- export class StaveConnector extends Element {
21
- constructor(top_stave, bottom_stave) {
22
- super();
23
- this.thickness = Tables.STAVE_LINE_THICKNESS;
24
- this.width = 3;
25
- this.top_stave = top_stave;
26
- this.bottom_stave = bottom_stave;
27
- this.type = StaveConnector.type.DOUBLE;
28
- this.resetFont();
29
- this.x_shift = 0;
30
- this.texts = [];
31
- }
32
- static get CATEGORY() {
33
- return "StaveConnector";
34
- }
35
- setType(type) {
36
- type = typeof type === 'string' ? StaveConnector.typeString[type] : type;
37
- if (type >= StaveConnector.type.SINGLE_RIGHT && type <= StaveConnector.type.NONE) {
38
- this.type = type;
39
- }
40
- return this;
41
- }
42
- setText(text, options = {}) {
43
- this.texts.push({
44
- content: text,
45
- options: Object.assign({ shift_x: 0, shift_y: 0 }, options),
46
- });
47
- return this;
48
- }
49
- setXShift(x_shift) {
50
- if (typeof x_shift !== 'number') {
51
- throw new RuntimeError('InvalidType', 'x_shift must be a Number');
52
- }
53
- this.x_shift = x_shift;
54
- return this;
55
- }
56
- getXShift() {
57
- return this.x_shift;
58
- }
59
- draw() {
60
- const ctx = this.checkContext();
61
- this.setRendered();
62
- let topY = this.top_stave.getYForLine(0);
63
- let botY = this.bottom_stave.getYForLine(this.bottom_stave.getNumLines() - 1) + this.thickness;
64
- let width = this.width;
65
- let topX = this.top_stave.getX();
66
- const isRightSidedConnector = this.type === StaveConnector.type.SINGLE_RIGHT ||
67
- this.type === StaveConnector.type.BOLD_DOUBLE_RIGHT ||
68
- this.type === StaveConnector.type.THIN_DOUBLE;
69
- if (isRightSidedConnector) {
70
- topX = this.top_stave.getX() + this.top_stave.getWidth();
71
- }
72
- let attachment_height = botY - topY;
73
- switch (this.type) {
74
- case StaveConnector.type.SINGLE:
75
- width = 1;
76
- break;
77
- case StaveConnector.type.SINGLE_LEFT:
78
- width = 1;
79
- break;
80
- case StaveConnector.type.SINGLE_RIGHT:
81
- width = 1;
82
- break;
83
- case StaveConnector.type.DOUBLE:
84
- topX -= this.width + 2;
85
- topY -= this.thickness;
86
- attachment_height += 0.5;
87
- break;
88
- case StaveConnector.type.BRACE: {
89
- width = 12;
90
- const x1 = this.top_stave.getX() - 2 + this.x_shift;
91
- const y1 = topY;
92
- const x3 = x1;
93
- const y3 = botY;
94
- const x2 = x1 - width;
95
- const y2 = y1 + attachment_height / 2.0;
96
- const cpx1 = x2 - 0.9 * width;
97
- const cpy1 = y1 + 0.2 * attachment_height;
98
- const cpx2 = x1 + 1.1 * width;
99
- const cpy2 = y2 - 0.135 * attachment_height;
100
- const cpx3 = cpx2;
101
- const cpy3 = y2 + 0.135 * attachment_height;
102
- const cpx4 = cpx1;
103
- const cpy4 = y3 - 0.2 * attachment_height;
104
- const cpx5 = x2 - width;
105
- const cpy5 = cpy4;
106
- const cpx6 = x1 + 0.4 * width;
107
- const cpy6 = y2 + 0.135 * attachment_height;
108
- const cpx7 = cpx6;
109
- const cpy7 = y2 - 0.135 * attachment_height;
110
- const cpx8 = cpx5;
111
- const cpy8 = cpy1;
112
- ctx.beginPath();
113
- ctx.moveTo(x1, y1);
114
- ctx.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x2, y2);
115
- ctx.bezierCurveTo(cpx3, cpy3, cpx4, cpy4, x3, y3);
116
- ctx.bezierCurveTo(cpx5, cpy5, cpx6, cpy6, x2, y2);
117
- ctx.bezierCurveTo(cpx7, cpy7, cpx8, cpy8, x1, y1);
118
- ctx.fill();
119
- ctx.stroke();
120
- break;
121
- }
122
- case StaveConnector.type.BRACKET:
123
- topY -= 6;
124
- botY += 6;
125
- attachment_height = botY - topY;
126
- Glyph.renderGlyph(ctx, topX - 5, topY, 40, 'bracketTop');
127
- Glyph.renderGlyph(ctx, topX - 5, botY, 40, 'bracketBottom');
128
- topX -= this.width + 2;
129
- break;
130
- case StaveConnector.type.BOLD_DOUBLE_LEFT:
131
- drawBoldDoubleLine(ctx, this.type, topX + this.x_shift, topY, botY - this.thickness);
132
- break;
133
- case StaveConnector.type.BOLD_DOUBLE_RIGHT:
134
- drawBoldDoubleLine(ctx, this.type, topX, topY, botY - this.thickness);
135
- break;
136
- case StaveConnector.type.THIN_DOUBLE:
137
- width = 1;
138
- attachment_height -= this.thickness;
139
- break;
140
- case StaveConnector.type.NONE:
141
- break;
142
- default:
143
- throw new RuntimeError('InvalidType', `The provided StaveConnector.type (${this.type}) is invalid.`);
144
- }
145
- if (this.type !== StaveConnector.type.BRACE &&
146
- this.type !== StaveConnector.type.BOLD_DOUBLE_LEFT &&
147
- this.type !== StaveConnector.type.BOLD_DOUBLE_RIGHT &&
148
- this.type !== StaveConnector.type.NONE) {
149
- ctx.fillRect(topX, topY, width, attachment_height);
150
- }
151
- if (this.type === StaveConnector.type.THIN_DOUBLE) {
152
- ctx.fillRect(topX - 3, topY, width, attachment_height);
153
- }
154
- ctx.save();
155
- ctx.setLineWidth(2);
156
- ctx.setFont(this.textFont);
157
- for (let i = 0; i < this.texts.length; i++) {
158
- const text = this.texts[i];
159
- const text_width = ctx.measureText('' + text.content).width;
160
- const x = this.top_stave.getX() - text_width - 24 + text.options.shift_x;
161
- const y = (this.top_stave.getYForLine(0) + this.bottom_stave.getBottomLineY()) / 2 + text.options.shift_y;
162
- ctx.fillText('' + text.content, x, y + 4);
163
- }
164
- ctx.restore();
165
- }
166
- }
167
- StaveConnector.TEXT_FONT = {
168
- family: Font.SERIF,
169
- size: 16,
170
- weight: FontWeight.NORMAL,
171
- style: FontStyle.NORMAL,
172
- };
173
- StaveConnector.type = {
174
- SINGLE_RIGHT: 0,
175
- SINGLE_LEFT: 1,
176
- SINGLE: 1,
177
- DOUBLE: 2,
178
- BRACE: 3,
179
- BRACKET: 4,
180
- BOLD_DOUBLE_LEFT: 5,
181
- BOLD_DOUBLE_RIGHT: 6,
182
- THIN_DOUBLE: 7,
183
- NONE: 8,
184
- };
185
- StaveConnector.typeString = {
186
- singleRight: StaveConnector.type.SINGLE_RIGHT,
187
- singleLeft: StaveConnector.type.SINGLE_LEFT,
188
- single: StaveConnector.type.SINGLE,
189
- double: StaveConnector.type.DOUBLE,
190
- brace: StaveConnector.type.BRACE,
191
- bracket: StaveConnector.type.BRACKET,
192
- boldDoubleLeft: StaveConnector.type.BOLD_DOUBLE_LEFT,
193
- boldDoubleRight: StaveConnector.type.BOLD_DOUBLE_RIGHT,
194
- thinDouble: StaveConnector.type.THIN_DOUBLE,
195
- none: StaveConnector.type.NONE,
196
- };
@@ -1,120 +0,0 @@
1
- import { Element } from './element.js';
2
- import { Modifier } from './modifier.js';
3
- import { RuntimeError } from './util.js';
4
- export class StaveHairpin extends Element {
5
- constructor(notes, type) {
6
- super();
7
- this.setNotes(notes);
8
- this.hairpin = type;
9
- this.position = Modifier.Position.BELOW;
10
- this.render_options = {
11
- height: 10,
12
- y_shift: 0,
13
- left_shift_px: 0,
14
- right_shift_px: 0,
15
- right_shift_ticks: 0,
16
- left_shift_ticks: 0,
17
- };
18
- }
19
- static get CATEGORY() {
20
- return "StaveHairpin";
21
- }
22
- static FormatByTicksAndDraw(ctx, formatter, notes, type, position, options) {
23
- var _a, _b;
24
- const ppt = formatter.pixelsPerTick;
25
- if (ppt == null) {
26
- throw new RuntimeError('BadArguments', 'A valid Formatter must be provide to draw offsets by ticks.');
27
- }
28
- const l_shift_px = ppt * ((_a = options.left_shift_ticks) !== null && _a !== void 0 ? _a : 0);
29
- const r_shift_px = ppt * ((_b = options.right_shift_ticks) !== null && _b !== void 0 ? _b : 0);
30
- const hairpin_options = {
31
- height: options.height,
32
- y_shift: options.y_shift,
33
- left_shift_px: l_shift_px,
34
- right_shift_px: r_shift_px,
35
- right_shift_ticks: 0,
36
- left_shift_ticks: 0,
37
- };
38
- new StaveHairpin({
39
- first_note: notes.first_note,
40
- last_note: notes.last_note,
41
- }, type)
42
- .setContext(ctx)
43
- .setRenderOptions(hairpin_options)
44
- .setPosition(position)
45
- .draw();
46
- }
47
- setPosition(position) {
48
- if (position === Modifier.Position.ABOVE || position === Modifier.Position.BELOW) {
49
- this.position = position;
50
- }
51
- return this;
52
- }
53
- setRenderOptions(options) {
54
- if (options.height != null &&
55
- options.y_shift != null &&
56
- options.left_shift_px != null &&
57
- options.right_shift_px != null) {
58
- this.render_options = options;
59
- }
60
- return this;
61
- }
62
- setNotes(notes) {
63
- if (!notes.first_note && !notes.last_note) {
64
- throw new RuntimeError('BadArguments', 'Hairpin needs to have either first_note or last_note set.');
65
- }
66
- this.notes = notes;
67
- this.first_note = notes.first_note;
68
- this.last_note = notes.last_note;
69
- return this;
70
- }
71
- renderHairpin(params) {
72
- const ctx = this.checkContext();
73
- let dis = this.render_options.y_shift + 20;
74
- let y_shift = params.first_y;
75
- if (this.position === Modifier.Position.ABOVE) {
76
- dis = -dis + 30;
77
- y_shift = params.first_y - params.staff_height;
78
- }
79
- const l_shift = this.render_options.left_shift_px;
80
- const r_shift = this.render_options.right_shift_px;
81
- ctx.beginPath();
82
- switch (this.hairpin) {
83
- case StaveHairpin.type.CRESC:
84
- ctx.moveTo(params.last_x + r_shift, y_shift + dis);
85
- ctx.lineTo(params.first_x + l_shift, y_shift + this.render_options.height / 2 + dis);
86
- ctx.lineTo(params.last_x + r_shift, y_shift + this.render_options.height + dis);
87
- break;
88
- case StaveHairpin.type.DECRESC:
89
- ctx.moveTo(params.first_x + l_shift, y_shift + dis);
90
- ctx.lineTo(params.last_x + r_shift, y_shift + this.render_options.height / 2 + dis);
91
- ctx.lineTo(params.first_x + l_shift, y_shift + this.render_options.height + dis);
92
- break;
93
- default:
94
- break;
95
- }
96
- ctx.stroke();
97
- ctx.closePath();
98
- }
99
- draw() {
100
- this.checkContext();
101
- this.setRendered();
102
- const firstNote = this.first_note;
103
- const lastNote = this.last_note;
104
- if (!firstNote || !lastNote)
105
- throw new RuntimeError('NoNote', 'Notes required to draw');
106
- const start = firstNote.getModifierStartXY(this.position, 0);
107
- const end = lastNote.getModifierStartXY(this.position, 0);
108
- this.renderHairpin({
109
- first_x: start.x,
110
- last_x: end.x,
111
- first_y: firstNote.checkStave().getY() + firstNote.checkStave().getHeight(),
112
- last_y: lastNote.checkStave().getY() + lastNote.checkStave().getHeight(),
113
- staff_height: firstNote.checkStave().getHeight(),
114
- });
115
- }
116
- }
117
- StaveHairpin.type = {
118
- CRESC: 1,
119
- DECRESC: 2,
120
- };