@tspro/web-music-score 4.0.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +17 -8
- package/dist/audio/index.js +1 -1
- package/dist/audio/index.mjs +2 -2
- package/dist/audio-cg/index.js +1 -1
- package/dist/audio-cg/index.mjs +2 -2
- package/dist/{chunk-YFPLOHP2.mjs → chunk-MHNTJ6FU.mjs} +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +3 -3
- package/dist/iife/index.global.js +11 -11
- package/dist/{music-objects-DJQ4d2OA.d.mts → music-objects-DIaqNPjs.d.mts} +68 -62
- package/dist/{music-objects-Dc3kR-XF.d.ts → music-objects-xJJNlFwK.d.ts} +68 -62
- package/dist/pieces/index.d.mts +2 -2
- package/dist/pieces/index.d.ts +2 -2
- package/dist/pieces/index.js +2 -2
- package/dist/pieces/index.mjs +3 -3
- package/dist/react-ui/index.d.mts +3 -3
- package/dist/react-ui/index.d.ts +3 -3
- package/dist/react-ui/index.js +1 -1
- package/dist/react-ui/index.mjs +2 -2
- package/dist/{scale-B2Icbetz.d.ts → scale-DQNA-YLD.d.ts} +1 -1
- package/dist/{scale-BbDJTbrG.d.mts → scale-bnD0WnMV.d.mts} +1 -1
- package/dist/score/index.d.mts +21 -6
- package/dist/score/index.d.ts +21 -6
- package/dist/score/index.js +137 -103
- package/dist/score/index.mjs +140 -106
- package/dist/{tempo-Dt8aHpol.d.ts → tempo-Bp1UzsrZ.d.ts} +40 -10
- package/dist/{tempo-CtUhvJbr.d.mts → tempo-S85Q7uJA.d.mts} +40 -10
- package/dist/theory/index.d.mts +3 -3
- package/dist/theory/index.d.ts +3 -3
- package/dist/theory/index.js +67 -20
- package/dist/theory/index.mjs +66 -21
- package/package.json +3 -2
package/dist/score/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, F as Fermata, b as StaffTabOrGroups, c as Navigation, A as AnnotationText, d as Annotation, L as Label, C as Connective, e as TieType, f as NoteAnchor, g as VerticalPosition } from '../music-objects-
|
|
2
|
-
export { a6 as Arpeggio, $ as Clef, D as DivRect, a8 as DynamicsAnnotation, q as MAccidental, s as MArpeggio, E as MBarLineLeft, B as MBarLineRight, t as MBeamGroup, r as MConnective, v as MEnding, _ as MExtensionLine, w as MFermata, x as MHeader, y as MImage, z as MMeasure, H as MNoteGroup, o as MPlaybackButtons, m as MPlayer, n as MRenderer, K as MRest, P as MRhythmColumn, Q as MScoreRow, X as MSignature, Y as MSpecialText, U as MStaff, u as MStaffBeamGroup, I as MStaffNoteGroup, O as MStaffRest, G as MStaffTabBarLine, W as MTab, J as MTabNoteGroup, Z as MText, p as MusicInterface, aa as PlayState, ab as PlayStateChangeListener, i as ScoreEvent, l as ScoreEventListener, h as ScoreEventType, k as ScoreObjectEvent, j as ScoreStaffPosEvent, a0 as StaffConfig, a7 as StaffTabOrGroup, a5 as Stem, a3 as StringNumber, a1 as TabConfig, a9 as TempoAnnotation, a4 as getStringNumbers, a2 as getVoiceIds } from '../music-objects-
|
|
1
|
+
import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, F as Fermata, b as StaffTabOrGroups, c as Navigation, A as AnnotationText, d as Annotation, L as Label, C as Connective, e as TieType, f as NoteAnchor, g as VerticalPosition } from '../music-objects-DIaqNPjs.mjs';
|
|
2
|
+
export { a6 as Arpeggio, $ as Clef, D as DivRect, a8 as DynamicsAnnotation, q as MAccidental, s as MArpeggio, E as MBarLineLeft, B as MBarLineRight, t as MBeamGroup, r as MConnective, v as MEnding, _ as MExtensionLine, w as MFermata, x as MHeader, y as MImage, z as MMeasure, H as MNoteGroup, o as MPlaybackButtons, m as MPlayer, n as MRenderer, K as MRest, P as MRhythmColumn, Q as MScoreRow, X as MSignature, Y as MSpecialText, U as MStaff, u as MStaffBeamGroup, I as MStaffNoteGroup, O as MStaffRest, G as MStaffTabBarLine, W as MTab, J as MTabNoteGroup, Z as MText, p as MusicInterface, aa as PlayState, ab as PlayStateChangeListener, i as ScoreEvent, l as ScoreEventListener, h as ScoreEventType, k as ScoreObjectEvent, j as ScoreStaffPosEvent, a0 as StaffConfig, a7 as StaffTabOrGroup, a5 as Stem, a3 as StringNumber, a1 as TabConfig, a9 as TempoAnnotation, a4 as getStringNumbers, a2 as getVoiceIds } from '../music-objects-DIaqNPjs.mjs';
|
|
3
3
|
import { N as Note } from '../note-eA2xPPiG.mjs';
|
|
4
|
-
import { S as ScaleType, c as Scale } from '../scale-
|
|
5
|
-
import { N as NoteLength,
|
|
4
|
+
import { S as ScaleType, c as Scale } from '../scale-bnD0WnMV.mjs';
|
|
5
|
+
import { N as NoteLength, i as NoteLengthStr, K as KeySignature, b as TimeSignature, T as TimeSignatures, B as BeamGrouping, k as TupletRatio } from '../tempo-S85Q7uJA.mjs';
|
|
6
6
|
import '@tspro/ts-utils-lib';
|
|
7
7
|
|
|
8
8
|
/** Tuplet builder type. */
|
|
@@ -140,10 +140,25 @@ declare class DocumentBuilder {
|
|
|
140
140
|
setKeySignature(scale: Scale): DocumentBuilder;
|
|
141
141
|
/**
|
|
142
142
|
* Set time signature for current measure and forward.
|
|
143
|
-
* @param timeSignature - TimeSignature
|
|
143
|
+
* @param timeSignature - TimeSignature object instance.
|
|
144
144
|
* @returns - This document builder instance.
|
|
145
145
|
*/
|
|
146
|
-
setTimeSignature(timeSignature: TimeSignature
|
|
146
|
+
setTimeSignature(timeSignature: TimeSignature): DocumentBuilder;
|
|
147
|
+
/**
|
|
148
|
+
* Set time signature for current measure and forward.
|
|
149
|
+
* @param timeSignature - TimeSignatures enum value or string (e.g. "3/4").
|
|
150
|
+
* @param beamGrouping - Beam grouping (e.g. "3-2" for time signature "5/8").
|
|
151
|
+
* @returns - This document builder instance.
|
|
152
|
+
*/
|
|
153
|
+
setTimeSignature(timeSignature: TimeSignatures | `${TimeSignatures}`, beamGrouping?: BeamGrouping | `${BeamGrouping}`): DocumentBuilder;
|
|
154
|
+
/**
|
|
155
|
+
* Set time signature for current measure and forward.
|
|
156
|
+
* @param beatCount - Beat count of time signature (e.g. 3 in "3/4").
|
|
157
|
+
* @param beatSize - Beat size of time signature (e.g. 4 in "3/4").
|
|
158
|
+
* @param beamGrouping - Beam grouping (e.g. "3-2" for time signature "5/8").
|
|
159
|
+
* @returns - This document builder instance.
|
|
160
|
+
*/
|
|
161
|
+
setTimeSignature(beatCount: number, beatSize: number, beamGrouping?: BeamGrouping | `${BeamGrouping}`): DocumentBuilder;
|
|
147
162
|
/**
|
|
148
163
|
* Set tempo.
|
|
149
164
|
* @param beatsPerMinute - Tempo beats per minute.
|
package/dist/score/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, F as Fermata, b as StaffTabOrGroups, c as Navigation, A as AnnotationText, d as Annotation, L as Label, C as Connective, e as TieType, f as NoteAnchor, g as VerticalPosition } from '../music-objects-
|
|
2
|
-
export { a6 as Arpeggio, $ as Clef, D as DivRect, a8 as DynamicsAnnotation, q as MAccidental, s as MArpeggio, E as MBarLineLeft, B as MBarLineRight, t as MBeamGroup, r as MConnective, v as MEnding, _ as MExtensionLine, w as MFermata, x as MHeader, y as MImage, z as MMeasure, H as MNoteGroup, o as MPlaybackButtons, m as MPlayer, n as MRenderer, K as MRest, P as MRhythmColumn, Q as MScoreRow, X as MSignature, Y as MSpecialText, U as MStaff, u as MStaffBeamGroup, I as MStaffNoteGroup, O as MStaffRest, G as MStaffTabBarLine, W as MTab, J as MTabNoteGroup, Z as MText, p as MusicInterface, aa as PlayState, ab as PlayStateChangeListener, i as ScoreEvent, l as ScoreEventListener, h as ScoreEventType, k as ScoreObjectEvent, j as ScoreStaffPosEvent, a0 as StaffConfig, a7 as StaffTabOrGroup, a5 as Stem, a3 as StringNumber, a1 as TabConfig, a9 as TempoAnnotation, a4 as getStringNumbers, a2 as getVoiceIds } from '../music-objects-
|
|
1
|
+
import { N as NoteOptions, R as RestOptions, S as StaffPreset, a as ScoreConfiguration, M as MDocument, V as VoiceId, T as TupletOptions, F as Fermata, b as StaffTabOrGroups, c as Navigation, A as AnnotationText, d as Annotation, L as Label, C as Connective, e as TieType, f as NoteAnchor, g as VerticalPosition } from '../music-objects-xJJNlFwK.js';
|
|
2
|
+
export { a6 as Arpeggio, $ as Clef, D as DivRect, a8 as DynamicsAnnotation, q as MAccidental, s as MArpeggio, E as MBarLineLeft, B as MBarLineRight, t as MBeamGroup, r as MConnective, v as MEnding, _ as MExtensionLine, w as MFermata, x as MHeader, y as MImage, z as MMeasure, H as MNoteGroup, o as MPlaybackButtons, m as MPlayer, n as MRenderer, K as MRest, P as MRhythmColumn, Q as MScoreRow, X as MSignature, Y as MSpecialText, U as MStaff, u as MStaffBeamGroup, I as MStaffNoteGroup, O as MStaffRest, G as MStaffTabBarLine, W as MTab, J as MTabNoteGroup, Z as MText, p as MusicInterface, aa as PlayState, ab as PlayStateChangeListener, i as ScoreEvent, l as ScoreEventListener, h as ScoreEventType, k as ScoreObjectEvent, j as ScoreStaffPosEvent, a0 as StaffConfig, a7 as StaffTabOrGroup, a5 as Stem, a3 as StringNumber, a1 as TabConfig, a9 as TempoAnnotation, a4 as getStringNumbers, a2 as getVoiceIds } from '../music-objects-xJJNlFwK.js';
|
|
3
3
|
import { N as Note } from '../note-eA2xPPiG.js';
|
|
4
|
-
import { S as ScaleType, c as Scale } from '../scale-
|
|
5
|
-
import { N as NoteLength,
|
|
4
|
+
import { S as ScaleType, c as Scale } from '../scale-DQNA-YLD.js';
|
|
5
|
+
import { N as NoteLength, i as NoteLengthStr, K as KeySignature, b as TimeSignature, T as TimeSignatures, B as BeamGrouping, k as TupletRatio } from '../tempo-Bp1UzsrZ.js';
|
|
6
6
|
import '@tspro/ts-utils-lib';
|
|
7
7
|
|
|
8
8
|
/** Tuplet builder type. */
|
|
@@ -140,10 +140,25 @@ declare class DocumentBuilder {
|
|
|
140
140
|
setKeySignature(scale: Scale): DocumentBuilder;
|
|
141
141
|
/**
|
|
142
142
|
* Set time signature for current measure and forward.
|
|
143
|
-
* @param timeSignature - TimeSignature
|
|
143
|
+
* @param timeSignature - TimeSignature object instance.
|
|
144
144
|
* @returns - This document builder instance.
|
|
145
145
|
*/
|
|
146
|
-
setTimeSignature(timeSignature: TimeSignature
|
|
146
|
+
setTimeSignature(timeSignature: TimeSignature): DocumentBuilder;
|
|
147
|
+
/**
|
|
148
|
+
* Set time signature for current measure and forward.
|
|
149
|
+
* @param timeSignature - TimeSignatures enum value or string (e.g. "3/4").
|
|
150
|
+
* @param beamGrouping - Beam grouping (e.g. "3-2" for time signature "5/8").
|
|
151
|
+
* @returns - This document builder instance.
|
|
152
|
+
*/
|
|
153
|
+
setTimeSignature(timeSignature: TimeSignatures | `${TimeSignatures}`, beamGrouping?: BeamGrouping | `${BeamGrouping}`): DocumentBuilder;
|
|
154
|
+
/**
|
|
155
|
+
* Set time signature for current measure and forward.
|
|
156
|
+
* @param beatCount - Beat count of time signature (e.g. 3 in "3/4").
|
|
157
|
+
* @param beatSize - Beat size of time signature (e.g. 4 in "3/4").
|
|
158
|
+
* @param beamGrouping - Beam grouping (e.g. "3-2" for time signature "5/8").
|
|
159
|
+
* @returns - This document builder instance.
|
|
160
|
+
*/
|
|
161
|
+
setTimeSignature(beatCount: number, beatSize: number, beamGrouping?: BeamGrouping | `${BeamGrouping}`): DocumentBuilder;
|
|
147
162
|
/**
|
|
148
163
|
* Set tempo.
|
|
149
164
|
* @param beatsPerMinute - Tempo beats per minute.
|
package/dist/score/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* WebMusicScore v4.0
|
|
1
|
+
/* WebMusicScore v4.1.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -124,11 +124,11 @@ var DivRect = class _DivRect {
|
|
|
124
124
|
/**
|
|
125
125
|
* Create rect from basic left, top, width and height arguments.
|
|
126
126
|
*
|
|
127
|
-
* @param left -
|
|
128
|
-
* @param top -
|
|
129
|
-
* @param width -
|
|
130
|
-
* @param height -
|
|
131
|
-
* @returns
|
|
127
|
+
* @param left - Left coordinate.
|
|
128
|
+
* @param top - Top coordinate.
|
|
129
|
+
* @param width - With.
|
|
130
|
+
* @param height - Height.
|
|
131
|
+
* @returns - DivRect.
|
|
132
132
|
*/
|
|
133
133
|
static create(left, top, width, height) {
|
|
134
134
|
return new _DivRect(left, left + width, top, top + height);
|
|
@@ -138,9 +138,9 @@ var DivRect = class _DivRect {
|
|
|
138
138
|
*
|
|
139
139
|
* @param centerX - Center x-coordinate.
|
|
140
140
|
* @param centerY - Center y-coordinate.
|
|
141
|
-
* @param width -
|
|
142
|
-
* @param height -
|
|
143
|
-
* @returns
|
|
141
|
+
* @param width - Width.
|
|
142
|
+
* @param height - Height.
|
|
143
|
+
* @returns - DivRect.
|
|
144
144
|
*/
|
|
145
145
|
static createCentered(centerX, centerY, width, height) {
|
|
146
146
|
return new _DivRect(centerX - width / 2, centerX + width / 2, centerY - height / 2, centerY + height / 2);
|
|
@@ -152,43 +152,43 @@ var DivRect = class _DivRect {
|
|
|
152
152
|
* @param rightw - Right section width.
|
|
153
153
|
* @param toph - Top section height.
|
|
154
154
|
* @param bottomh - Bottomsection height.
|
|
155
|
-
* @returns
|
|
155
|
+
* @returns - DivRect.
|
|
156
156
|
*/
|
|
157
157
|
static createSections(leftw, rightw, toph, bottomh) {
|
|
158
158
|
return new _DivRect(-leftw, 0, rightw, -toph, 0, bottomh);
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
|
-
* Width.
|
|
161
|
+
* Width getter.
|
|
162
162
|
*/
|
|
163
163
|
get width() {
|
|
164
164
|
return this.right - this.left;
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
|
-
* Height.
|
|
167
|
+
* Height getter.
|
|
168
168
|
*/
|
|
169
169
|
get height() {
|
|
170
170
|
return this.bottom - this.top;
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
-
* Left section width.
|
|
173
|
+
* Left section width getter.
|
|
174
174
|
*/
|
|
175
175
|
get leftw() {
|
|
176
176
|
return this.centerX - this.left;
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
|
-
* Right section width.
|
|
179
|
+
* Right section width getter.
|
|
180
180
|
*/
|
|
181
181
|
get rightw() {
|
|
182
182
|
return this.right - this.centerX;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
|
-
* Top section height.
|
|
185
|
+
* Top section height getter.
|
|
186
186
|
*/
|
|
187
187
|
get toph() {
|
|
188
188
|
return this.centerY - this.top;
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
|
-
* Bottom section height.
|
|
191
|
+
* Bottom section height getter.
|
|
192
192
|
*/
|
|
193
193
|
get bottomh() {
|
|
194
194
|
return this.bottom - this.centerY;
|
|
@@ -196,9 +196,9 @@ var DivRect = class _DivRect {
|
|
|
196
196
|
/**
|
|
197
197
|
* Does this Rect contain given (x, y)-point?
|
|
198
198
|
*
|
|
199
|
-
* @param x -
|
|
200
|
-
* @param y -
|
|
201
|
-
* @returns
|
|
199
|
+
* @param x - X-coordinate.
|
|
200
|
+
* @param y - Y-coordinate.
|
|
201
|
+
* @returns - True/false.
|
|
202
202
|
*/
|
|
203
203
|
contains(x, y) {
|
|
204
204
|
return x >= this.left && x <= this.right && y >= this.top && y <= this.bottom;
|
|
@@ -206,9 +206,9 @@ var DivRect = class _DivRect {
|
|
|
206
206
|
/**
|
|
207
207
|
* Do a and b rects overlap?
|
|
208
208
|
*
|
|
209
|
-
* @param a -
|
|
210
|
-
* @param b -
|
|
211
|
-
* @returns
|
|
209
|
+
* @param a - DivRect a.
|
|
210
|
+
* @param b - DivRect b.
|
|
211
|
+
* @returns - True/false.
|
|
212
212
|
*/
|
|
213
213
|
static overlap(a, b) {
|
|
214
214
|
return a.right > b.left && a.left < b.right && a.bottom > b.top && a.top < b.bottom;
|
|
@@ -216,17 +216,18 @@ var DivRect = class _DivRect {
|
|
|
216
216
|
/**
|
|
217
217
|
* Do horizontal measures of a and b rects overlap?
|
|
218
218
|
*
|
|
219
|
-
* @param a -
|
|
220
|
-
* @param b -
|
|
221
|
-
* @returns
|
|
219
|
+
* @param a - DivRect a.
|
|
220
|
+
* @param b - DivRect b.
|
|
221
|
+
* @returns - True/false.
|
|
222
222
|
*/
|
|
223
223
|
static overlapX(a, b) {
|
|
224
224
|
return a.right > b.left && a.left < b.right;
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
227
227
|
* Check if this Rect equals with given Rect.
|
|
228
|
-
* @param
|
|
229
|
-
* @
|
|
228
|
+
* @param a - DivRect a.
|
|
229
|
+
* @param b - DivRect b.
|
|
230
|
+
* @returns - True/false.
|
|
230
231
|
*/
|
|
231
232
|
static equals(a, b) {
|
|
232
233
|
if (a == null && b == null) {
|
|
@@ -238,10 +239,11 @@ var DivRect = class _DivRect {
|
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
241
|
/**
|
|
241
|
-
* Check if frame
|
|
242
|
+
* Check if frame of this Rect equals with given Rect, ignoring center x- and center y-coordinates.
|
|
242
243
|
*
|
|
243
|
-
* @param
|
|
244
|
-
* @
|
|
244
|
+
* @param a - DivRect a.
|
|
245
|
+
* @param b - DivRect b.
|
|
246
|
+
* @returns - True/false.
|
|
245
247
|
*/
|
|
246
248
|
static equalsFrame(a, b) {
|
|
247
249
|
if (a == null && b == null) {
|
|
@@ -255,7 +257,7 @@ var DivRect = class _DivRect {
|
|
|
255
257
|
/**
|
|
256
258
|
* Created duplicate of this Rect.
|
|
257
259
|
*
|
|
258
|
-
* @returns
|
|
260
|
+
* @returns - Duplicate.
|
|
259
261
|
*/
|
|
260
262
|
copy() {
|
|
261
263
|
return new _DivRect(this.left, this.centerX, this.right, this.top, this.centerY, this.bottom);
|
|
@@ -263,9 +265,9 @@ var DivRect = class _DivRect {
|
|
|
263
265
|
/**
|
|
264
266
|
* Move this rect by (dx, dy). Modifies this Rect.
|
|
265
267
|
*
|
|
266
|
-
* @param dx -
|
|
267
|
-
* @param dy -
|
|
268
|
-
* @returns
|
|
268
|
+
* @param dx - Offset amount in x-direction.
|
|
269
|
+
* @param dy - Offset amount in y-direction.
|
|
270
|
+
* @returns - This DivRect instance.
|
|
269
271
|
*/
|
|
270
272
|
offsetInPlace(dx, dy) {
|
|
271
273
|
this.left += dx;
|
|
@@ -279,9 +281,9 @@ var DivRect = class _DivRect {
|
|
|
279
281
|
/**
|
|
280
282
|
* Move this rect by (dx, dy). Immutable, returns modified copy.
|
|
281
283
|
*
|
|
282
|
-
* @param dx -
|
|
283
|
-
* @param dy -
|
|
284
|
-
* @returns
|
|
284
|
+
* @param dx - Offset amount in x-direction.
|
|
285
|
+
* @param dy - Offset amount in y-direction.
|
|
286
|
+
* @returns - DivRect copy with applied offset.
|
|
285
287
|
*/
|
|
286
288
|
offsetCopy(dx, dy) {
|
|
287
289
|
return this.copy().offsetInPlace(dx, dy);
|
|
@@ -289,8 +291,8 @@ var DivRect = class _DivRect {
|
|
|
289
291
|
/**
|
|
290
292
|
* Expand this Rect by given Rect. Modifies this Rect.
|
|
291
293
|
*
|
|
292
|
-
* @param rect -
|
|
293
|
-
* @returns
|
|
294
|
+
* @param rect - DivRect to expand this instance with.
|
|
295
|
+
* @returns - This DivRect instance.
|
|
294
296
|
*/
|
|
295
297
|
expandInPlace(rect) {
|
|
296
298
|
this.left = Math.min(this.left, rect.left);
|
|
@@ -302,8 +304,8 @@ var DivRect = class _DivRect {
|
|
|
302
304
|
/**
|
|
303
305
|
* Expand this Rect by given Rect. Immutable, returns modified copy.
|
|
304
306
|
*
|
|
305
|
-
* @param rect -
|
|
306
|
-
* @returns
|
|
307
|
+
* @param rect - DivRect to expand this instance with.
|
|
308
|
+
* @returns - Expanded copy of this DivRect.
|
|
307
309
|
*/
|
|
308
310
|
expandCopy(rect) {
|
|
309
311
|
return this.copy().expandInPlace(rect);
|
|
@@ -311,8 +313,8 @@ var DivRect = class _DivRect {
|
|
|
311
313
|
/**
|
|
312
314
|
* Clip this Rect by given Rect. Mmodifies this Rect.
|
|
313
315
|
*
|
|
314
|
-
* @param clipRect -
|
|
315
|
-
* @returns
|
|
316
|
+
* @param clipRect - DivRect to clip this instance with.
|
|
317
|
+
* @returns - This DivRect instance.
|
|
316
318
|
*/
|
|
317
319
|
clipInPlace(clipRect) {
|
|
318
320
|
this.left = Math.max(this.left, clipRect.left);
|
|
@@ -326,8 +328,8 @@ var DivRect = class _DivRect {
|
|
|
326
328
|
/**
|
|
327
329
|
* Clip this Rect by given Rect. Immutable, return modified copy.
|
|
328
330
|
*
|
|
329
|
-
* @param clipRect -
|
|
330
|
-
* @returns
|
|
331
|
+
* @param clipRect - DivRecto to clip this instance with.
|
|
332
|
+
* @returns - Clipped DivRect copy.
|
|
331
333
|
*/
|
|
332
334
|
clipCopy(clipRect) {
|
|
333
335
|
return this.copy().clipInPlace(clipRect);
|
|
@@ -335,9 +337,9 @@ var DivRect = class _DivRect {
|
|
|
335
337
|
/**
|
|
336
338
|
* Scale Rect. Anchor pos is (centerX, centerY). Modifies this Rect.
|
|
337
339
|
*
|
|
338
|
-
* @param scaleX -
|
|
339
|
-
* @param scaleY -
|
|
340
|
-
* @returns
|
|
340
|
+
* @param scaleX - Scale x-amount.
|
|
341
|
+
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
342
|
+
* @returns This DivRect instance.
|
|
341
343
|
*/
|
|
342
344
|
scaleInPlace(scaleX, scaleY) {
|
|
343
345
|
scaleY = scaleY != null ? scaleY : scaleX;
|
|
@@ -350,13 +352,17 @@ var DivRect = class _DivRect {
|
|
|
350
352
|
/**
|
|
351
353
|
* Scale Rect. Anchor pos is (centerX, centerY). Immutable, returns modified copy.
|
|
352
354
|
*
|
|
353
|
-
* @param scaleX -
|
|
354
|
-
* @param scaleY -
|
|
355
|
-
* @returns
|
|
355
|
+
* @param scaleX - Scale x-amount.
|
|
356
|
+
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
357
|
+
* @returns Scaled copy of this DivRect.
|
|
356
358
|
*/
|
|
357
359
|
scaleCopy(scaleX, scaleY) {
|
|
358
360
|
return this.copy().scaleInPlace(scaleX, scaleY);
|
|
359
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Get this DivRect instance.
|
|
364
|
+
* @returns - This DivRect instance.
|
|
365
|
+
*/
|
|
360
366
|
getRect() {
|
|
361
367
|
return this;
|
|
362
368
|
}
|
|
@@ -1365,9 +1371,9 @@ var ObjSignature = class extends MusicObject {
|
|
|
1365
1371
|
if (showTimeSignature) {
|
|
1366
1372
|
let timeSignature = this.measure.getTimeSignature();
|
|
1367
1373
|
let beatCount = timeSignature.beatCount.toString();
|
|
1368
|
-
this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0, 0.5);
|
|
1374
|
+
this.beatCountText = new ObjText(this, { text: beatCount, scale: 1.4 }, 0.5, 0.5);
|
|
1369
1375
|
let beatSize = timeSignature.beatSize.toString();
|
|
1370
|
-
this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0, 0.5);
|
|
1376
|
+
this.beatSizeText = new ObjText(this, { text: beatSize, scale: 1.4 }, 0.5, 0.5);
|
|
1371
1377
|
} else {
|
|
1372
1378
|
this.beatCountText = this.beatSizeText = void 0;
|
|
1373
1379
|
}
|
|
@@ -1457,6 +1463,7 @@ var ObjSignature = class extends MusicObject {
|
|
|
1457
1463
|
return [this];
|
|
1458
1464
|
}
|
|
1459
1465
|
layout(renderer) {
|
|
1466
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1460
1467
|
let { unitSize } = renderer;
|
|
1461
1468
|
let { staff } = this;
|
|
1462
1469
|
let paddingX = unitSize;
|
|
@@ -1501,15 +1508,16 @@ var ObjSignature = class extends MusicObject {
|
|
|
1501
1508
|
});
|
|
1502
1509
|
}
|
|
1503
1510
|
let right = x;
|
|
1511
|
+
(_a = this.beatCountText) == null ? void 0 : _a.layout(renderer);
|
|
1512
|
+
(_b = this.beatSizeText) == null ? void 0 : _b.layout(renderer);
|
|
1513
|
+
let tsWidth = Math.max((_d = (_c = this.beatCountText) == null ? void 0 : _c.getRect().width) != null ? _d : 0, (_f = (_e = this.beatSizeText) == null ? void 0 : _e.getRect().width) != null ? _f : 0);
|
|
1504
1514
|
if (this.beatCountText) {
|
|
1505
|
-
this.beatCountText.
|
|
1506
|
-
this.beatCountText.offset(x + paddingX, staff.getDiatonicIdY(staff.middleLineDiatonicId + 2));
|
|
1515
|
+
this.beatCountText.offset(x + tsWidth / 2 + paddingX, staff.getDiatonicIdY(staff.middleLineDiatonicId + 2));
|
|
1507
1516
|
this.rect.expandInPlace(this.beatCountText.getRect());
|
|
1508
1517
|
right = Math.max(right, this.rect.right);
|
|
1509
1518
|
}
|
|
1510
1519
|
if (this.beatSizeText) {
|
|
1511
|
-
this.beatSizeText.
|
|
1512
|
-
this.beatSizeText.offset(x + paddingX, staff.getDiatonicIdY(staff.bottomLineDiatonicId + 2));
|
|
1520
|
+
this.beatSizeText.offset(x + tsWidth / 2 + paddingX, staff.getDiatonicIdY(staff.bottomLineDiatonicId + 2));
|
|
1513
1521
|
this.rect.expandInPlace(this.beatSizeText.getRect());
|
|
1514
1522
|
right = Math.max(right, this.rect.right);
|
|
1515
1523
|
}
|
|
@@ -2898,11 +2906,10 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
|
|
|
2898
2906
|
}
|
|
2899
2907
|
setStemTipY(staff, stemTipY) {
|
|
2900
2908
|
let obj = this.staffObjects.find((obj2) => obj2.staff === staff);
|
|
2901
|
-
if (
|
|
2902
|
-
|
|
2909
|
+
if (this.hasBeamCount() && (obj == null ? void 0 : obj.stemTip) && stemTipY !== obj.stemTip.centerY) {
|
|
2910
|
+
obj.stemTip.top = obj.stemTip.centerY = obj.stemTip.bottom = stemTipY;
|
|
2911
|
+
this.requestRectUpdate();
|
|
2903
2912
|
}
|
|
2904
|
-
obj.stemTip.top = obj.stemTip.centerY = obj.stemTip.bottom = stemTipY;
|
|
2905
|
-
this.requestRectUpdate();
|
|
2906
2913
|
}
|
|
2907
2914
|
offset(dx, dy) {
|
|
2908
2915
|
this.staffObjects.forEach((obj) => obj.offset(dx, 0));
|
|
@@ -5111,7 +5118,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
|
|
|
5111
5118
|
setTimeSignature(timeSignature) {
|
|
5112
5119
|
var _a;
|
|
5113
5120
|
(_a = this.getPrevMeasure()) == null ? void 0 : _a.endSection();
|
|
5114
|
-
this.alterTimeSignature = timeSignature
|
|
5121
|
+
this.alterTimeSignature = timeSignature;
|
|
5115
5122
|
this.updateTimeSignature();
|
|
5116
5123
|
}
|
|
5117
5124
|
updateTimeSignature() {
|
|
@@ -5641,52 +5648,77 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
|
|
|
5641
5648
|
return false;
|
|
5642
5649
|
}
|
|
5643
5650
|
});
|
|
5651
|
+
let ts = this.getTimeSignature();
|
|
5652
|
+
if (!this.needBeamsUpdate || ts.beamGroupSizes.length === 0) {
|
|
5653
|
+
return;
|
|
5654
|
+
}
|
|
5644
5655
|
getVoiceIds().forEach((voiceId) => {
|
|
5645
|
-
let symbols = this.getVoiceSymbols(voiceId);
|
|
5646
|
-
if (symbols.length
|
|
5647
|
-
|
|
5648
|
-
}
|
|
5649
|
-
if (!DebugSettings.DisableBeams) {
|
|
5650
|
-
let groupSymbols = [];
|
|
5656
|
+
let symbols = this.getVoiceSymbols(voiceId).slice();
|
|
5657
|
+
if (symbols.length >= 2) {
|
|
5658
|
+
let symbolsStartTicks = this.isUpBeat() ? Math.max(0, this.getMeasureTicks() - this.getConsumedTicks()) : 0;
|
|
5651
5659
|
let groupStartTicks = 0;
|
|
5652
|
-
let
|
|
5653
|
-
|
|
5654
|
-
let
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5660
|
+
for (let groupId = 0; groupId < ts.beamGroupSizes.length; groupId++) {
|
|
5661
|
+
let beamGroupSize = ts.beamGroupSizes[groupId];
|
|
5662
|
+
let groupSizeSum = 0;
|
|
5663
|
+
beamGroupSize.forEach((s) => groupSizeSum += s);
|
|
5664
|
+
let groupLength = groupSizeSum * import_theory9.NoteLengthProps.get("8n").ticks;
|
|
5665
|
+
let groupSymbols = [];
|
|
5666
|
+
let groupSymbolsLength = 0;
|
|
5667
|
+
while (symbols.length > 0 && groupSymbolsLength < groupLength) {
|
|
5668
|
+
let symbol = symbols[0];
|
|
5669
|
+
if (symbol.col.positionTicks >= groupStartTicks) {
|
|
5670
|
+
groupSymbols.push(symbol);
|
|
5671
|
+
groupSymbolsLength += symbol.rhythmProps.ticks;
|
|
5672
|
+
symbols.shift();
|
|
5673
|
+
} else {
|
|
5674
|
+
break;
|
|
5675
|
+
}
|
|
5667
5676
|
}
|
|
5668
|
-
|
|
5677
|
+
_ObjMeasure.setupBeamGroup(groupSymbols, beamGroupSize);
|
|
5678
|
+
symbolsStartTicks += groupSymbolsLength;
|
|
5679
|
+
groupStartTicks += groupLength;
|
|
5680
|
+
}
|
|
5669
5681
|
}
|
|
5670
5682
|
});
|
|
5671
5683
|
this.needBeamsUpdate = false;
|
|
5672
5684
|
this.requestLayout();
|
|
5673
5685
|
}
|
|
5674
|
-
static setupBeamGroup(groupSymbols) {
|
|
5686
|
+
static setupBeamGroup(groupSymbols, mainBeamGroupSizeArr) {
|
|
5687
|
+
if (mainBeamGroupSizeArr.length === 0) {
|
|
5688
|
+
return false;
|
|
5689
|
+
}
|
|
5675
5690
|
let groupNotes = groupSymbols.map((s) => {
|
|
5676
5691
|
var _a;
|
|
5677
5692
|
return s instanceof ObjNoteGroup && ((_a = s.getBeamGroup()) == null ? void 0 : _a.isTuplet()) !== true ? s : void 0;
|
|
5678
5693
|
});
|
|
5679
5694
|
ObjNoteGroup.setBeamCounts(groupNotes);
|
|
5680
|
-
let
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5695
|
+
let beamGroupSizeArrList = [mainBeamGroupSizeArr];
|
|
5696
|
+
if (mainBeamGroupSizeArr.length > 1) {
|
|
5697
|
+
let sum = 0;
|
|
5698
|
+
mainBeamGroupSizeArr.forEach((s) => sum += s);
|
|
5699
|
+
beamGroupSizeArrList.unshift([sum]);
|
|
5700
|
+
}
|
|
5701
|
+
let beamsCreated = false;
|
|
5702
|
+
while (beamGroupSizeArrList.length > 0 && !beamsCreated) {
|
|
5703
|
+
let beamGroupSizeArr = beamGroupSizeArrList.shift();
|
|
5704
|
+
let groupSymbolsCopy = groupSymbols.slice();
|
|
5705
|
+
beamGroupSizeArr.forEach((beamGroupSize) => {
|
|
5706
|
+
var _a;
|
|
5707
|
+
let beamGroupLength = beamGroupSize * import_theory9.NoteLengthProps.get("8n").ticks;
|
|
5708
|
+
let beamNotesLength = 0;
|
|
5709
|
+
let beamNotes = [];
|
|
5710
|
+
while (beamNotesLength < beamGroupLength && groupSymbolsCopy.length > 0) {
|
|
5711
|
+
let symbol = groupSymbolsCopy.shift();
|
|
5712
|
+
beamNotesLength += symbol.rhythmProps.ticks;
|
|
5713
|
+
beamNotes.push(symbol instanceof ObjNoteGroup && ((_a = symbol.getBeamGroup()) == null ? void 0 : _a.isTuplet()) !== true ? symbol : void 0);
|
|
5714
|
+
}
|
|
5715
|
+
if (beamNotesLength === beamGroupLength && beamNotes.every((n) => n !== void 0) && (beamNotes.every((n) => n.rhythmProps.flagCount === 1) || beamGroupSizeArrList.length === 0)) {
|
|
5716
|
+
ObjBeamGroup.createBeam(beamNotes);
|
|
5717
|
+
beamsCreated = true;
|
|
5718
|
+
}
|
|
5719
|
+
});
|
|
5720
|
+
}
|
|
5721
|
+
return beamsCreated;
|
|
5690
5722
|
}
|
|
5691
5723
|
getBarLineLeft() {
|
|
5692
5724
|
return this.barLineLeft;
|
|
@@ -7203,14 +7235,16 @@ var DocumentBuilder = class {
|
|
|
7203
7235
|
this.getMeasure().setKeySignature(...args);
|
|
7204
7236
|
return this;
|
|
7205
7237
|
}
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7238
|
+
setTimeSignature(...args) {
|
|
7239
|
+
if (args[0] instanceof import_theory13.TimeSignature) {
|
|
7240
|
+
this.getMeasure().setTimeSignature(args[0]);
|
|
7241
|
+
} else if (import_ts_utils_lib13.Utils.Is.isEnumValue(args[0], import_theory13.TimeSignatures) && import_ts_utils_lib13.Utils.Is.isEnumValueOrUndefined(args[1], import_theory13.BeamGrouping)) {
|
|
7242
|
+
this.getMeasure().setTimeSignature(new import_theory13.TimeSignature(args[0], args[1]));
|
|
7243
|
+
} else if (import_ts_utils_lib13.Utils.Is.isIntegerGte(args[0], 1) && import_ts_utils_lib13.Utils.Is.isIntegerGte(args[1], 1) && import_ts_utils_lib13.Utils.Is.isEnumValueOrUndefined(args[2], import_theory13.BeamGrouping)) {
|
|
7244
|
+
this.getMeasure().setTimeSignature(new import_theory13.TimeSignature(args[0], args[1], args[2]));
|
|
7245
|
+
} else {
|
|
7246
|
+
assertArg(false, "timeSignature args", args);
|
|
7247
|
+
}
|
|
7214
7248
|
return this;
|
|
7215
7249
|
}
|
|
7216
7250
|
setTempo(beatsPerMinute, beatLength, dotted) {
|