@coderline/alphatab 1.3.0-alpha.135 → 1.3.0-alpha.139
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/dist/alphaTab.d.ts +43 -3
- package/dist/alphaTab.js +331 -170
- package/dist/alphaTab.min.js +2 -2
- package/dist/alphaTab.min.mjs +2 -2
- package/dist/alphaTab.mjs +331 -170
- package/package.json +9 -9
package/dist/alphaTab.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* alphaTab v1.3.0-alpha.
|
|
2
|
+
* alphaTab v1.3.0-alpha.139 (develop, build 139)
|
|
3
3
|
*
|
|
4
4
|
* Copyright © 2021, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
5
|
*
|
|
@@ -6926,6 +6926,9 @@
|
|
|
6926
6926
|
break;
|
|
6927
6927
|
}
|
|
6928
6928
|
}
|
|
6929
|
+
isNoteText(txt) {
|
|
6930
|
+
return txt === 'x' || txt === '-' || txt === 'r';
|
|
6931
|
+
}
|
|
6929
6932
|
note(beat) {
|
|
6930
6933
|
// fret.string
|
|
6931
6934
|
let isDead = false;
|
|
@@ -7328,7 +7331,7 @@
|
|
|
7328
7331
|
let text = this._syData;
|
|
7329
7332
|
this._sy = this.newSy();
|
|
7330
7333
|
let marker = '';
|
|
7331
|
-
if (this._sy === AlphaTexSymbols.String) {
|
|
7334
|
+
if (this._sy === AlphaTexSymbols.String && !this.isNoteText(this._syData.toLowerCase())) {
|
|
7332
7335
|
marker = text;
|
|
7333
7336
|
text = this._syData;
|
|
7334
7337
|
this._sy = this.newSy();
|
|
@@ -17249,6 +17252,7 @@
|
|
|
17249
17252
|
set masterVolume(value) {
|
|
17250
17253
|
value = Math.max(value, SynthConstants.MinVolume);
|
|
17251
17254
|
this._synthesizer.masterVolume = value;
|
|
17255
|
+
this.onAudioSettingsUpdate();
|
|
17252
17256
|
}
|
|
17253
17257
|
get metronomeVolume() {
|
|
17254
17258
|
return this._metronomeVolume;
|
|
@@ -17257,6 +17261,7 @@
|
|
|
17257
17261
|
value = Math.max(value, SynthConstants.MinVolume);
|
|
17258
17262
|
this._metronomeVolume = value;
|
|
17259
17263
|
this._synthesizer.metronomeVolume = value;
|
|
17264
|
+
this.onAudioSettingsUpdate();
|
|
17260
17265
|
}
|
|
17261
17266
|
get countInVolume() {
|
|
17262
17267
|
return this._countInVolume;
|
|
@@ -17278,7 +17283,7 @@
|
|
|
17278
17283
|
value = SynthHelper.clamp(value, SynthConstants.MinPlaybackSpeed, SynthConstants.MaxPlaybackSpeed);
|
|
17279
17284
|
let oldSpeed = this._sequencer.playbackSpeed;
|
|
17280
17285
|
this._sequencer.playbackSpeed = value;
|
|
17281
|
-
this.
|
|
17286
|
+
this.timePosition = this.timePosition * (oldSpeed / value);
|
|
17282
17287
|
}
|
|
17283
17288
|
get tickPosition() {
|
|
17284
17289
|
return this._tickPosition;
|
|
@@ -17430,16 +17435,25 @@
|
|
|
17430
17435
|
}
|
|
17431
17436
|
setChannelMute(channel, mute) {
|
|
17432
17437
|
this._synthesizer.channelSetMute(channel, mute);
|
|
17438
|
+
this.onAudioSettingsUpdate();
|
|
17433
17439
|
}
|
|
17434
17440
|
resetChannelStates() {
|
|
17435
17441
|
this._synthesizer.resetChannelStates();
|
|
17436
17442
|
}
|
|
17437
17443
|
setChannelSolo(channel, solo) {
|
|
17438
17444
|
this._synthesizer.channelSetSolo(channel, solo);
|
|
17445
|
+
this.onAudioSettingsUpdate();
|
|
17439
17446
|
}
|
|
17440
17447
|
setChannelVolume(channel, volume) {
|
|
17441
17448
|
volume = Math.max(volume, SynthConstants.MinVolume);
|
|
17442
17449
|
this._synthesizer.channelSetMixVolume(channel, volume);
|
|
17450
|
+
this.onAudioSettingsUpdate();
|
|
17451
|
+
}
|
|
17452
|
+
onAudioSettingsUpdate() {
|
|
17453
|
+
// seeking to the currently known position, will ensure we
|
|
17454
|
+
// clear all audio buffers and re-generate the audio
|
|
17455
|
+
// which was not actually played yet.
|
|
17456
|
+
this.timePosition = this.timePosition;
|
|
17443
17457
|
}
|
|
17444
17458
|
onSamplesPlayed(sampleCount) {
|
|
17445
17459
|
let playedMillis = (sampleCount / this._synthesizer.outSampleRate) * 1000;
|
|
@@ -20848,6 +20862,18 @@
|
|
|
20848
20862
|
*/
|
|
20849
20863
|
class RenderFinishedEventArgs {
|
|
20850
20864
|
constructor() {
|
|
20865
|
+
/**
|
|
20866
|
+
* Gets or sets the unique id of this event args.
|
|
20867
|
+
*/
|
|
20868
|
+
this.id = ModelUtils.newGuid();
|
|
20869
|
+
/**
|
|
20870
|
+
* Gets or sets the x position of the current rendering result.
|
|
20871
|
+
*/
|
|
20872
|
+
this.x = 0;
|
|
20873
|
+
/**
|
|
20874
|
+
* Gets or sets the y position of the current rendering result.
|
|
20875
|
+
*/
|
|
20876
|
+
this.y = 0;
|
|
20851
20877
|
/**
|
|
20852
20878
|
* Gets or sets the width of the current rendering result.
|
|
20853
20879
|
*/
|
|
@@ -21386,6 +21412,7 @@
|
|
|
21386
21412
|
this.preRender = new EventEmitterOfT();
|
|
21387
21413
|
this.renderFinished = new EventEmitterOfT();
|
|
21388
21414
|
this.partialRenderFinished = new EventEmitterOfT();
|
|
21415
|
+
this.partialLayoutFinished = new EventEmitterOfT();
|
|
21389
21416
|
this.postRenderFinished = new EventEmitter();
|
|
21390
21417
|
this.error = new EventEmitterOfT();
|
|
21391
21418
|
this.settings = settings;
|
|
@@ -21457,6 +21484,21 @@
|
|
|
21457
21484
|
updateSettings(settings) {
|
|
21458
21485
|
this.settings = settings;
|
|
21459
21486
|
}
|
|
21487
|
+
renderResult(resultId) {
|
|
21488
|
+
try {
|
|
21489
|
+
const layout = this.layout;
|
|
21490
|
+
if (layout) {
|
|
21491
|
+
Logger.debug('Rendering', 'Request render of lazy partial ' + resultId);
|
|
21492
|
+
layout.renderLazyPartial(resultId);
|
|
21493
|
+
}
|
|
21494
|
+
else {
|
|
21495
|
+
Logger.warning('Rendering', 'Request render of lazy partial ' + resultId + ' ignored, no layout exists');
|
|
21496
|
+
}
|
|
21497
|
+
}
|
|
21498
|
+
catch (e) {
|
|
21499
|
+
this.error.trigger(e);
|
|
21500
|
+
}
|
|
21501
|
+
}
|
|
21460
21502
|
render() {
|
|
21461
21503
|
if (this.width === 0) {
|
|
21462
21504
|
Logger.warning('Rendering', 'AlphaTab skipped rendering because of width=0 (element invisible)', null);
|
|
@@ -21490,7 +21532,6 @@
|
|
|
21490
21532
|
this.preRender.trigger(true);
|
|
21491
21533
|
this.canvas.settings = this.settings;
|
|
21492
21534
|
this.layout.resize();
|
|
21493
|
-
this.layout.renderAnnotation();
|
|
21494
21535
|
this.onRenderFinished();
|
|
21495
21536
|
this.postRenderFinished.trigger();
|
|
21496
21537
|
}
|
|
@@ -21502,7 +21543,6 @@
|
|
|
21502
21543
|
layoutAndRender() {
|
|
21503
21544
|
Logger.debug('Rendering', 'Rendering at scale ' + this.settings.display.scale + ' with layout ' + this.layout.name, null);
|
|
21504
21545
|
this.layout.layoutAndRender();
|
|
21505
|
-
this.layout.renderAnnotation();
|
|
21506
21546
|
this._renderedTracks = this.tracks;
|
|
21507
21547
|
this.onRenderFinished();
|
|
21508
21548
|
this.postRenderFinished.trigger();
|
|
@@ -21541,6 +21581,12 @@
|
|
|
21541
21581
|
result: result
|
|
21542
21582
|
});
|
|
21543
21583
|
});
|
|
21584
|
+
this._renderer.partialLayoutFinished.on(result => {
|
|
21585
|
+
this._main.postMessage({
|
|
21586
|
+
cmd: 'alphaTab.partialLayoutFinished',
|
|
21587
|
+
result: result
|
|
21588
|
+
});
|
|
21589
|
+
});
|
|
21544
21590
|
this._renderer.renderFinished.on(result => {
|
|
21545
21591
|
this._main.postMessage({
|
|
21546
21592
|
cmd: 'alphaTab.renderFinished',
|
|
@@ -21568,6 +21614,9 @@
|
|
|
21568
21614
|
case 'alphaTab.resizeRender':
|
|
21569
21615
|
this._renderer.resizeRender();
|
|
21570
21616
|
break;
|
|
21617
|
+
case 'alphaTab.renderResult':
|
|
21618
|
+
this._renderer.renderResult(data.resultId);
|
|
21619
|
+
break;
|
|
21571
21620
|
case 'alphaTab.setWidth':
|
|
21572
21621
|
this._renderer.width = data.width;
|
|
21573
21622
|
break;
|
|
@@ -23937,7 +23986,8 @@
|
|
|
23937
23986
|
this.renderer.preRender.on(_ => {
|
|
23938
23987
|
this._startTime = Date.now();
|
|
23939
23988
|
});
|
|
23940
|
-
this.renderer.
|
|
23989
|
+
this.renderer.partialLayoutFinished.on(this.appendRenderResult.bind(this));
|
|
23990
|
+
this.renderer.partialRenderFinished.on(this.updateRenderResult.bind(this));
|
|
23941
23991
|
this.renderer.renderFinished.on(r => {
|
|
23942
23992
|
this.appendRenderResult(r);
|
|
23943
23993
|
this.appendRenderResult(null); // marks last element
|
|
@@ -24099,8 +24149,11 @@
|
|
|
24099
24149
|
this._cursorWrapper.height = result.totalHeight;
|
|
24100
24150
|
}
|
|
24101
24151
|
}
|
|
24102
|
-
|
|
24103
|
-
|
|
24152
|
+
this.uiFacade.beginAppendRenderResults(result);
|
|
24153
|
+
}
|
|
24154
|
+
updateRenderResult(result) {
|
|
24155
|
+
if (result && result.renderResult) {
|
|
24156
|
+
this.uiFacade.beginUpdateRenderResults(result);
|
|
24104
24157
|
}
|
|
24105
24158
|
}
|
|
24106
24159
|
/**
|
|
@@ -25956,6 +26009,7 @@
|
|
|
25956
26009
|
this.boundsLookup = null;
|
|
25957
26010
|
this.preRender = new EventEmitterOfT();
|
|
25958
26011
|
this.partialRenderFinished = new EventEmitterOfT();
|
|
26012
|
+
this.partialLayoutFinished = new EventEmitterOfT();
|
|
25959
26013
|
this.renderFinished = new EventEmitterOfT();
|
|
25960
26014
|
this.postRenderFinished = new EventEmitter();
|
|
25961
26015
|
this.error = new EventEmitterOfT();
|
|
@@ -26008,6 +26062,12 @@
|
|
|
26008
26062
|
cmd: 'alphaTab.resizeRender'
|
|
26009
26063
|
});
|
|
26010
26064
|
}
|
|
26065
|
+
renderResult(resultId) {
|
|
26066
|
+
this._worker.postMessage({
|
|
26067
|
+
cmd: 'alphaTab.renderResult',
|
|
26068
|
+
resultId: resultId
|
|
26069
|
+
});
|
|
26070
|
+
}
|
|
26011
26071
|
get width() {
|
|
26012
26072
|
return this._width;
|
|
26013
26073
|
}
|
|
@@ -26028,6 +26088,9 @@
|
|
|
26028
26088
|
case 'alphaTab.partialRenderFinished':
|
|
26029
26089
|
this.partialRenderFinished.trigger(data.result);
|
|
26030
26090
|
break;
|
|
26091
|
+
case 'alphaTab.partialLayoutFinished':
|
|
26092
|
+
this.partialLayoutFinished.trigger(data.result);
|
|
26093
|
+
break;
|
|
26031
26094
|
case 'alphaTab.renderFinished':
|
|
26032
26095
|
this.renderFinished.trigger(data.result);
|
|
26033
26096
|
break;
|
|
@@ -26241,6 +26304,16 @@
|
|
|
26241
26304
|
}
|
|
26242
26305
|
}
|
|
26243
26306
|
|
|
26307
|
+
/**
|
|
26308
|
+
* @target web
|
|
26309
|
+
*/
|
|
26310
|
+
var ResultState;
|
|
26311
|
+
(function (ResultState) {
|
|
26312
|
+
ResultState[ResultState["LayoutDone"] = 0] = "LayoutDone";
|
|
26313
|
+
ResultState[ResultState["RenderRequested"] = 1] = "RenderRequested";
|
|
26314
|
+
ResultState[ResultState["RenderDone"] = 2] = "RenderDone";
|
|
26315
|
+
ResultState[ResultState["Detached"] = 3] = "Detached";
|
|
26316
|
+
})(ResultState || (ResultState = {}));
|
|
26244
26317
|
/**
|
|
26245
26318
|
* @target web
|
|
26246
26319
|
*/
|
|
@@ -26252,12 +26325,12 @@
|
|
|
26252
26325
|
this._totalResultCount = 0;
|
|
26253
26326
|
this._initialTrackIndexes = null;
|
|
26254
26327
|
this._barToElementLookup = new Map();
|
|
26328
|
+
this._resultIdToElementLookup = new Map();
|
|
26255
26329
|
this.rootContainerBecameVisible = new EventEmitter();
|
|
26256
26330
|
this.canRenderChanged = new EventEmitter();
|
|
26257
26331
|
this._highlightedElements = [];
|
|
26258
26332
|
this._scrollContainer = null;
|
|
26259
|
-
if (Environment.webPlatform !== WebPlatform.Browser &&
|
|
26260
|
-
Environment.webPlatform !== WebPlatform.BrowserModule) {
|
|
26333
|
+
if (Environment.webPlatform !== WebPlatform.Browser && Environment.webPlatform !== WebPlatform.BrowserModule) {
|
|
26261
26334
|
throw new AlphaTabError(exports.AlphaTabErrorType.General, 'Usage of AlphaTabApi is only possible in browser environments. For usage in node use the Low Level APIs');
|
|
26262
26335
|
}
|
|
26263
26336
|
rootElement.classList.add('alphaTab');
|
|
@@ -26300,15 +26373,34 @@
|
|
|
26300
26373
|
}
|
|
26301
26374
|
onElementVisibilityChanged(entries) {
|
|
26302
26375
|
for (const e of entries) {
|
|
26303
|
-
|
|
26304
|
-
|
|
26305
|
-
if (
|
|
26376
|
+
const htmlElement = e.target;
|
|
26377
|
+
if (htmlElement === this.rootContainer.element) {
|
|
26378
|
+
if (e.isIntersecting) {
|
|
26306
26379
|
this.rootContainerBecameVisible.trigger();
|
|
26307
26380
|
this._intersectionObserver.unobserve(this.rootContainer.element);
|
|
26308
26381
|
}
|
|
26309
|
-
|
|
26310
|
-
|
|
26311
|
-
|
|
26382
|
+
}
|
|
26383
|
+
else if ('layoutResultId' in htmlElement && this._api.settings.core.enableLazyLoading) {
|
|
26384
|
+
const placeholder = htmlElement;
|
|
26385
|
+
if (e.isIntersecting) {
|
|
26386
|
+
// missing result or result not matching layout -> request render
|
|
26387
|
+
if (placeholder.renderedResultId !== placeholder.layoutResultId) {
|
|
26388
|
+
if (this._resultIdToElementLookup.has(placeholder.layoutResultId)) {
|
|
26389
|
+
this._api.renderer.renderResult(placeholder.layoutResultId);
|
|
26390
|
+
}
|
|
26391
|
+
else {
|
|
26392
|
+
htmlElement.replaceChildren();
|
|
26393
|
+
}
|
|
26394
|
+
}
|
|
26395
|
+
// detached and became visible
|
|
26396
|
+
else if (placeholder.resultState === ResultState.Detached) {
|
|
26397
|
+
htmlElement.replaceChildren(...placeholder.renderedResult);
|
|
26398
|
+
placeholder.resultState = ResultState.RenderDone;
|
|
26399
|
+
}
|
|
26400
|
+
}
|
|
26401
|
+
else if (placeholder.resultState === ResultState.RenderDone) {
|
|
26402
|
+
placeholder.resultState = ResultState.Detached;
|
|
26403
|
+
placeholder.replaceChildren();
|
|
26312
26404
|
}
|
|
26313
26405
|
}
|
|
26314
26406
|
}
|
|
@@ -26437,6 +26529,7 @@
|
|
|
26437
26529
|
initialRender() {
|
|
26438
26530
|
this._api.renderer.preRender.on((_) => {
|
|
26439
26531
|
this._totalResultCount = 0;
|
|
26532
|
+
this._resultIdToElementLookup.clear();
|
|
26440
26533
|
this._barToElementLookup.clear();
|
|
26441
26534
|
});
|
|
26442
26535
|
const initialRender = () => {
|
|
@@ -26559,57 +26652,68 @@
|
|
|
26559
26652
|
}
|
|
26560
26653
|
return dataAttributes;
|
|
26561
26654
|
}
|
|
26655
|
+
beginUpdateRenderResults(renderResult) {
|
|
26656
|
+
if (!this._resultIdToElementLookup.has(renderResult.id)) {
|
|
26657
|
+
return;
|
|
26658
|
+
}
|
|
26659
|
+
const placeholder = this._resultIdToElementLookup.get(renderResult.id);
|
|
26660
|
+
const body = renderResult.renderResult;
|
|
26661
|
+
if (typeof body === 'string') {
|
|
26662
|
+
placeholder.innerHTML = body;
|
|
26663
|
+
}
|
|
26664
|
+
else if ('nodeType' in body) {
|
|
26665
|
+
placeholder.replaceChildren(body);
|
|
26666
|
+
}
|
|
26667
|
+
placeholder.resultState = ResultState.RenderDone;
|
|
26668
|
+
placeholder.renderedResultId = renderResult.id;
|
|
26669
|
+
placeholder.renderedResult = Array.from(placeholder.children);
|
|
26670
|
+
}
|
|
26562
26671
|
beginAppendRenderResults(renderResult) {
|
|
26563
|
-
|
|
26672
|
+
const canvasElement = this._api.canvasElement.element;
|
|
26564
26673
|
// null result indicates that the rendering finished
|
|
26565
26674
|
if (!renderResult) {
|
|
26566
26675
|
// so we remove elements that might be from a previous render session
|
|
26567
26676
|
while (canvasElement.childElementCount > this._totalResultCount) {
|
|
26677
|
+
if (this._api.settings.core.enableLazyLoading) {
|
|
26678
|
+
this._intersectionObserver.unobserve(canvasElement.lastChild);
|
|
26679
|
+
}
|
|
26568
26680
|
canvasElement.removeChild(canvasElement.lastChild);
|
|
26569
26681
|
}
|
|
26570
26682
|
}
|
|
26571
26683
|
else {
|
|
26572
|
-
let
|
|
26573
|
-
if (
|
|
26574
|
-
|
|
26575
|
-
if (this._totalResultCount < canvasElement.childElementCount) {
|
|
26576
|
-
placeholder = canvasElement.childNodes.item(this._totalResultCount);
|
|
26577
|
-
}
|
|
26578
|
-
else {
|
|
26579
|
-
placeholder = document.createElement('div');
|
|
26580
|
-
canvasElement.appendChild(placeholder);
|
|
26581
|
-
}
|
|
26582
|
-
placeholder.style.width = renderResult.width + 'px';
|
|
26583
|
-
placeholder.style.height = renderResult.height + 'px';
|
|
26584
|
-
placeholder.style.display = 'inline-block';
|
|
26585
|
-
if (!this._api.settings.core.enableLazyLoading) {
|
|
26586
|
-
this.replacePlaceholder(placeholder, body);
|
|
26587
|
-
}
|
|
26588
|
-
else {
|
|
26589
|
-
placeholder.dataset['svg'] = body;
|
|
26590
|
-
this._intersectionObserver.observe(placeholder);
|
|
26591
|
-
}
|
|
26592
|
-
// remember which bar is contained in which node for faster lookup
|
|
26593
|
-
// on highlight/unhighlight
|
|
26594
|
-
for (let i = renderResult.firstMasterBarIndex; i <= renderResult.lastMasterBarIndex; i++) {
|
|
26595
|
-
this._barToElementLookup.set(i, placeholder);
|
|
26596
|
-
}
|
|
26684
|
+
let placeholder;
|
|
26685
|
+
if (this._totalResultCount < canvasElement.childElementCount) {
|
|
26686
|
+
placeholder = canvasElement.childNodes.item(this._totalResultCount);
|
|
26597
26687
|
}
|
|
26598
26688
|
else {
|
|
26599
|
-
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26689
|
+
placeholder = document.createElement('div');
|
|
26690
|
+
canvasElement.appendChild(placeholder);
|
|
26691
|
+
}
|
|
26692
|
+
placeholder.style.zIndex = '1';
|
|
26693
|
+
placeholder.style.position = 'absolute';
|
|
26694
|
+
placeholder.style.left = renderResult.x + 'px';
|
|
26695
|
+
placeholder.style.top = renderResult.y + 'px';
|
|
26696
|
+
placeholder.style.width = renderResult.width + 'px';
|
|
26697
|
+
placeholder.style.height = renderResult.height + 'px';
|
|
26698
|
+
placeholder.style.display = 'inline-block';
|
|
26699
|
+
placeholder.layoutResultId = renderResult.id;
|
|
26700
|
+
placeholder.resultState = ResultState.LayoutDone;
|
|
26701
|
+
delete placeholder.renderedResultId;
|
|
26702
|
+
delete placeholder.renderedResult;
|
|
26703
|
+
this._resultIdToElementLookup.set(renderResult.id, placeholder);
|
|
26704
|
+
// remember which bar is contained in which node for faster lookup
|
|
26705
|
+
// on highlight/unhighlight
|
|
26706
|
+
for (let i = renderResult.firstMasterBarIndex; i <= renderResult.lastMasterBarIndex; i++) {
|
|
26707
|
+
this._barToElementLookup.set(i, placeholder);
|
|
26708
|
+
}
|
|
26709
|
+
if (this._api.settings.core.enableLazyLoading) {
|
|
26710
|
+
// re-observe to fire event
|
|
26711
|
+
this._intersectionObserver.unobserve(placeholder);
|
|
26712
|
+
this._intersectionObserver.observe(placeholder);
|
|
26605
26713
|
}
|
|
26606
26714
|
this._totalResultCount++;
|
|
26607
26715
|
}
|
|
26608
26716
|
}
|
|
26609
|
-
replacePlaceholder(placeholder, body) {
|
|
26610
|
-
placeholder.innerHTML = body;
|
|
26611
|
-
delete placeholder.dataset['svg'];
|
|
26612
|
-
}
|
|
26613
26717
|
/**
|
|
26614
26718
|
* This method creates the player. It detects browser compatibility and
|
|
26615
26719
|
* initializes a alphaSynth version for the client.
|
|
@@ -32073,6 +32177,12 @@
|
|
|
32073
32177
|
}
|
|
32074
32178
|
}
|
|
32075
32179
|
|
|
32180
|
+
class LazyPartial {
|
|
32181
|
+
constructor(args, renderCallback) {
|
|
32182
|
+
this.args = args;
|
|
32183
|
+
this.renderCallback = renderCallback;
|
|
32184
|
+
}
|
|
32185
|
+
}
|
|
32076
32186
|
/**
|
|
32077
32187
|
* This is the base public class for creating new layouting engines for the score renderer.
|
|
32078
32188
|
*/
|
|
@@ -32084,11 +32194,17 @@
|
|
|
32084
32194
|
this.scoreInfoGlyphs = new Map();
|
|
32085
32195
|
this.chordDiagrams = null;
|
|
32086
32196
|
this.tuningGlyph = null;
|
|
32197
|
+
this._lazyPartials = new Map();
|
|
32087
32198
|
this.firstBarIndex = 0;
|
|
32088
32199
|
this.lastBarIndex = 0;
|
|
32089
32200
|
this.renderer = renderer;
|
|
32090
32201
|
}
|
|
32202
|
+
resize() {
|
|
32203
|
+
this._lazyPartials.clear();
|
|
32204
|
+
this.doResize();
|
|
32205
|
+
}
|
|
32091
32206
|
layoutAndRender() {
|
|
32207
|
+
this._lazyPartials.clear();
|
|
32092
32208
|
let score = this.renderer.score;
|
|
32093
32209
|
let startIndex = this.renderer.settings.display.startBar;
|
|
32094
32210
|
startIndex--; // map to array index
|
|
@@ -32104,6 +32220,28 @@
|
|
|
32104
32220
|
this.createScoreInfoGlyphs();
|
|
32105
32221
|
this.doLayoutAndRender();
|
|
32106
32222
|
}
|
|
32223
|
+
registerPartial(args, callback) {
|
|
32224
|
+
this.renderer.partialLayoutFinished.trigger(args);
|
|
32225
|
+
if (!this.renderer.settings.core.enableLazyLoading) {
|
|
32226
|
+
this.internalRenderLazyPartial(args, callback);
|
|
32227
|
+
}
|
|
32228
|
+
else {
|
|
32229
|
+
this._lazyPartials.set(args.id, new LazyPartial(args, callback));
|
|
32230
|
+
}
|
|
32231
|
+
}
|
|
32232
|
+
internalRenderLazyPartial(args, callback) {
|
|
32233
|
+
const canvas = this.renderer.canvas;
|
|
32234
|
+
canvas.beginRender(args.width, args.height);
|
|
32235
|
+
callback(canvas);
|
|
32236
|
+
args.renderResult = canvas.endRender();
|
|
32237
|
+
this.renderer.partialRenderFinished.trigger(args);
|
|
32238
|
+
}
|
|
32239
|
+
renderLazyPartial(resultId) {
|
|
32240
|
+
if (this._lazyPartials.has(resultId)) {
|
|
32241
|
+
const lazyPartial = this._lazyPartials.get(resultId);
|
|
32242
|
+
this.internalRenderLazyPartial(lazyPartial.args, lazyPartial.renderCallback);
|
|
32243
|
+
}
|
|
32244
|
+
}
|
|
32107
32245
|
createScoreInfoGlyphs() {
|
|
32108
32246
|
Logger.debug('ScoreLayout', 'Creating score info glyphs');
|
|
32109
32247
|
let notation = this.renderer.settings.notation;
|
|
@@ -32240,30 +32378,33 @@
|
|
|
32240
32378
|
}
|
|
32241
32379
|
return null;
|
|
32242
32380
|
}
|
|
32243
|
-
|
|
32381
|
+
layoutAndRenderAnnotation(y) {
|
|
32244
32382
|
// attention, you are not allowed to remove change this notice within any version of this library without permission!
|
|
32245
32383
|
let msg = 'rendered by alphaTab';
|
|
32246
|
-
let canvas = this.renderer.canvas;
|
|
32247
32384
|
let resources = this.renderer.settings.display.resources;
|
|
32248
32385
|
let size = 12 * this.renderer.settings.display.scale;
|
|
32249
|
-
let height = size * 2;
|
|
32250
|
-
|
|
32251
|
-
|
|
32252
|
-
canvas.
|
|
32253
|
-
|
|
32254
|
-
|
|
32255
|
-
canvas.textAlign = TextAlign.Center;
|
|
32256
|
-
canvas.fillText(msg, x, size);
|
|
32257
|
-
let result = canvas.endRender();
|
|
32258
|
-
let e = new RenderFinishedEventArgs();
|
|
32259
|
-
e.width = this.width;
|
|
32386
|
+
let height = Math.floor(size * 2);
|
|
32387
|
+
const e = new RenderFinishedEventArgs();
|
|
32388
|
+
const font = new Font(resources.copyrightFont.family, size, FontStyle.Plain, FontWeight.Bold);
|
|
32389
|
+
this.renderer.canvas.font = font;
|
|
32390
|
+
const centered = Environment.getLayoutEngineFactory(this.renderer.settings.display.layoutMode).vertical;
|
|
32391
|
+
e.width = this.renderer.canvas.measureText(msg);
|
|
32260
32392
|
e.height = height;
|
|
32261
|
-
e.
|
|
32393
|
+
e.x = centered
|
|
32394
|
+
? (this.width - e.width) / 2
|
|
32395
|
+
: this.firstBarX;
|
|
32396
|
+
e.y = y;
|
|
32262
32397
|
e.totalWidth = this.width;
|
|
32263
32398
|
e.totalHeight = this.height;
|
|
32264
32399
|
e.firstMasterBarIndex = -1;
|
|
32265
32400
|
e.lastMasterBarIndex = -1;
|
|
32266
|
-
this.
|
|
32401
|
+
this.registerPartial(e, canvas => {
|
|
32402
|
+
canvas.color = resources.mainGlyphColor;
|
|
32403
|
+
canvas.font = font;
|
|
32404
|
+
canvas.textAlign = TextAlign.Left;
|
|
32405
|
+
canvas.fillText(msg, 0, size);
|
|
32406
|
+
});
|
|
32407
|
+
return y + height;
|
|
32267
32408
|
}
|
|
32268
32409
|
}
|
|
32269
32410
|
|
|
@@ -32288,7 +32429,19 @@
|
|
|
32288
32429
|
get supportsResize() {
|
|
32289
32430
|
return false;
|
|
32290
32431
|
}
|
|
32291
|
-
|
|
32432
|
+
get padding() {
|
|
32433
|
+
return this._pagePadding;
|
|
32434
|
+
}
|
|
32435
|
+
get firstBarX() {
|
|
32436
|
+
let x = this._pagePadding[0];
|
|
32437
|
+
if (this._group) {
|
|
32438
|
+
x += this._group.accoladeSpacing;
|
|
32439
|
+
}
|
|
32440
|
+
return x;
|
|
32441
|
+
}
|
|
32442
|
+
doResize() {
|
|
32443
|
+
// not supported
|
|
32444
|
+
}
|
|
32292
32445
|
doLayoutAndRender() {
|
|
32293
32446
|
this._pagePadding = this.renderer.settings.display.padding;
|
|
32294
32447
|
if (!this._pagePadding) {
|
|
@@ -32311,7 +32464,6 @@
|
|
|
32311
32464
|
];
|
|
32312
32465
|
}
|
|
32313
32466
|
let score = this.renderer.score;
|
|
32314
|
-
let canvas = this.renderer.canvas;
|
|
32315
32467
|
let startIndex = this.renderer.settings.display.startBar;
|
|
32316
32468
|
startIndex--; // map to array index
|
|
32317
32469
|
startIndex = Math.min(score.masterBars.length - 1, Math.max(0, startIndex));
|
|
@@ -32370,35 +32522,39 @@
|
|
|
32370
32522
|
currentPartial.masterBars[currentPartial.masterBars.length - 1].index, null);
|
|
32371
32523
|
}
|
|
32372
32524
|
this._group.finalizeGroup();
|
|
32373
|
-
this.height = this._group.y + this._group.height
|
|
32525
|
+
this.height = Math.floor(this._group.y + this._group.height);
|
|
32374
32526
|
this.width = this._group.x + this._group.width + this._pagePadding[2];
|
|
32375
32527
|
currentBarIndex = 0;
|
|
32528
|
+
let x = 0;
|
|
32376
32529
|
for (let i = 0; i < partials.length; i++) {
|
|
32377
32530
|
let partial = partials[i];
|
|
32378
|
-
|
|
32379
|
-
|
|
32380
|
-
|
|
32381
|
-
let renderX = this._group.getBarX(partial.masterBars[0].index) + this._group.accoladeSpacing;
|
|
32382
|
-
if (i === 0) {
|
|
32383
|
-
renderX -= this._group.x + this._group.accoladeSpacing;
|
|
32384
|
-
}
|
|
32385
|
-
Logger.debug(this.name, 'Rendering partial from bar ' +
|
|
32386
|
-
partial.masterBars[0].index +
|
|
32387
|
-
' to ' +
|
|
32388
|
-
partial.masterBars[partial.masterBars.length - 1].index, null);
|
|
32389
|
-
this._group.paintPartial(-renderX, this._group.y, this.renderer.canvas, currentBarIndex, partial.masterBars.length);
|
|
32390
|
-
let result = canvas.endRender();
|
|
32391
|
-
let e = new RenderFinishedEventArgs();
|
|
32531
|
+
const e = new RenderFinishedEventArgs();
|
|
32532
|
+
e.x = x;
|
|
32533
|
+
e.y = 0;
|
|
32392
32534
|
e.totalWidth = this.width;
|
|
32393
32535
|
e.totalHeight = this.height;
|
|
32394
32536
|
e.width = partial.width;
|
|
32395
32537
|
e.height = this.height;
|
|
32396
|
-
e.renderResult = result;
|
|
32397
32538
|
e.firstMasterBarIndex = partial.masterBars[0].index;
|
|
32398
32539
|
e.lastMasterBarIndex = partial.masterBars[partial.masterBars.length - 1].index;
|
|
32399
|
-
|
|
32540
|
+
x += partial.width;
|
|
32541
|
+
const partialBarIndex = currentBarIndex;
|
|
32542
|
+
this.registerPartial(e, canvas => {
|
|
32543
|
+
canvas.color = this.renderer.settings.display.resources.mainGlyphColor;
|
|
32544
|
+
canvas.textAlign = TextAlign.Left;
|
|
32545
|
+
let renderX = this._group.getBarX(partial.masterBars[0].index) + this._group.accoladeSpacing;
|
|
32546
|
+
if (i === 0) {
|
|
32547
|
+
renderX -= this._group.x + this._group.accoladeSpacing;
|
|
32548
|
+
}
|
|
32549
|
+
Logger.debug(this.name, 'Rendering partial from bar ' +
|
|
32550
|
+
partial.masterBars[0].index +
|
|
32551
|
+
' to ' +
|
|
32552
|
+
partial.masterBars[partial.masterBars.length - 1].index, null);
|
|
32553
|
+
this._group.paintPartial(-renderX, this._group.y, canvas, partialBarIndex, partial.masterBars.length);
|
|
32554
|
+
});
|
|
32400
32555
|
currentBarIndex += partial.masterBars.length;
|
|
32401
32556
|
}
|
|
32557
|
+
this.height = this.layoutAndRenderAnnotation(this.height) + this._pagePadding[3];
|
|
32402
32558
|
}
|
|
32403
32559
|
}
|
|
32404
32560
|
HorizontalScreenLayout.PagePadding = [20, 20, 20, 20];
|
|
@@ -32439,13 +32595,12 @@
|
|
|
32439
32595
|
this._pagePadding[1]
|
|
32440
32596
|
];
|
|
32441
32597
|
}
|
|
32442
|
-
let
|
|
32443
|
-
let y = this._pagePadding[1];
|
|
32598
|
+
let y = 0;
|
|
32444
32599
|
this.width = this.renderer.width;
|
|
32445
32600
|
this._allMasterBarRenderers = [];
|
|
32446
32601
|
//
|
|
32447
32602
|
// 1. Score Info
|
|
32448
|
-
y = this.layoutAndRenderScoreInfo(
|
|
32603
|
+
y = this.layoutAndRenderScoreInfo(y, -1);
|
|
32449
32604
|
//
|
|
32450
32605
|
// 2. Tunings
|
|
32451
32606
|
y = this.layoutAndRenderTunings(y, -1);
|
|
@@ -32454,20 +32609,30 @@
|
|
|
32454
32609
|
y = this.layoutAndRenderChordDiagrams(y, -1);
|
|
32455
32610
|
//
|
|
32456
32611
|
// 4. One result per StaveGroup
|
|
32457
|
-
y = this.layoutAndRenderScore(
|
|
32612
|
+
y = this.layoutAndRenderScore(y);
|
|
32613
|
+
y = this.layoutAndRenderAnnotation(y);
|
|
32458
32614
|
this.height = y + this._pagePadding[3];
|
|
32459
32615
|
}
|
|
32460
32616
|
get supportsResize() {
|
|
32461
32617
|
return true;
|
|
32462
32618
|
}
|
|
32463
|
-
|
|
32619
|
+
get padding() {
|
|
32620
|
+
return this._pagePadding;
|
|
32621
|
+
}
|
|
32622
|
+
get firstBarX() {
|
|
32464
32623
|
let x = this._pagePadding[0];
|
|
32465
|
-
|
|
32624
|
+
if (this._groups.length > 0) {
|
|
32625
|
+
x += this._groups[0].accoladeSpacing;
|
|
32626
|
+
}
|
|
32627
|
+
return x;
|
|
32628
|
+
}
|
|
32629
|
+
doResize() {
|
|
32630
|
+
let y = 0;
|
|
32466
32631
|
this.width = this.renderer.width;
|
|
32467
32632
|
let oldHeight = this.height;
|
|
32468
32633
|
//
|
|
32469
32634
|
// 1. Score Info
|
|
32470
|
-
y = this.layoutAndRenderScoreInfo(
|
|
32635
|
+
y = this.layoutAndRenderScoreInfo(y, oldHeight);
|
|
32471
32636
|
//
|
|
32472
32637
|
// 2. Tunings
|
|
32473
32638
|
y = this.layoutAndRenderTunings(y, oldHeight);
|
|
@@ -32476,7 +32641,8 @@
|
|
|
32476
32641
|
y = this.layoutAndRenderChordDiagrams(y, oldHeight);
|
|
32477
32642
|
//
|
|
32478
32643
|
// 4. One result per StaveGroup
|
|
32479
|
-
y = this.resizeAndRenderScore(
|
|
32644
|
+
y = this.resizeAndRenderScore(y, oldHeight);
|
|
32645
|
+
y = this.layoutAndRenderAnnotation(y);
|
|
32480
32646
|
this.height = y + this._pagePadding[3];
|
|
32481
32647
|
}
|
|
32482
32648
|
layoutAndRenderTunings(y, totalHeight = -1) {
|
|
@@ -32484,54 +32650,56 @@
|
|
|
32484
32650
|
return y;
|
|
32485
32651
|
}
|
|
32486
32652
|
let res = this.renderer.settings.display.resources;
|
|
32653
|
+
this.tuningGlyph.x = this._pagePadding[0];
|
|
32487
32654
|
this.tuningGlyph.width = this.width;
|
|
32488
32655
|
this.tuningGlyph.doLayout();
|
|
32489
32656
|
let tuningHeight = this.tuningGlyph.height + 11 * this.scale;
|
|
32490
|
-
|
|
32491
|
-
|
|
32492
|
-
|
|
32493
|
-
canvas.color = res.scoreInfoColor;
|
|
32494
|
-
canvas.textAlign = TextAlign.Center;
|
|
32495
|
-
this.tuningGlyph.paint(this._pagePadding[0], 0, canvas);
|
|
32496
|
-
let result = canvas.endRender();
|
|
32497
|
-
let e = new RenderFinishedEventArgs();
|
|
32657
|
+
const e = new RenderFinishedEventArgs();
|
|
32658
|
+
e.x = 0;
|
|
32659
|
+
e.y = y;
|
|
32498
32660
|
e.width = this.width;
|
|
32499
32661
|
e.height = tuningHeight;
|
|
32500
|
-
e.renderResult = result;
|
|
32501
32662
|
e.totalWidth = this.width;
|
|
32502
|
-
e.totalHeight = totalHeight < 0 ? y : totalHeight;
|
|
32663
|
+
e.totalHeight = totalHeight < 0 ? y + e.height : totalHeight;
|
|
32503
32664
|
e.firstMasterBarIndex = -1;
|
|
32504
32665
|
e.lastMasterBarIndex = -1;
|
|
32505
|
-
this.
|
|
32506
|
-
|
|
32666
|
+
this.registerPartial(e, (canvas) => {
|
|
32667
|
+
canvas.color = res.scoreInfoColor;
|
|
32668
|
+
canvas.textAlign = TextAlign.Center;
|
|
32669
|
+
this.tuningGlyph.paint(0, 0, canvas);
|
|
32670
|
+
});
|
|
32671
|
+
return y + tuningHeight;
|
|
32507
32672
|
}
|
|
32508
32673
|
layoutAndRenderChordDiagrams(y, totalHeight = -1) {
|
|
32509
32674
|
if (!this.chordDiagrams) {
|
|
32510
32675
|
return y;
|
|
32511
32676
|
}
|
|
32512
|
-
|
|
32677
|
+
const res = this.renderer.settings.display.resources;
|
|
32513
32678
|
this.chordDiagrams.width = this.width;
|
|
32514
32679
|
this.chordDiagrams.doLayout();
|
|
32515
|
-
|
|
32516
|
-
|
|
32517
|
-
|
|
32518
|
-
|
|
32519
|
-
this.chordDiagrams.paint(0, 0, canvas);
|
|
32520
|
-
let result = canvas.endRender();
|
|
32521
|
-
y += this.chordDiagrams.height;
|
|
32522
|
-
let e = new RenderFinishedEventArgs();
|
|
32680
|
+
const diagramHeight = Math.floor(this.chordDiagrams.height);
|
|
32681
|
+
const e = new RenderFinishedEventArgs();
|
|
32682
|
+
e.x = 0;
|
|
32683
|
+
e.y = y;
|
|
32523
32684
|
e.width = this.width;
|
|
32524
|
-
e.height =
|
|
32525
|
-
e.renderResult = result;
|
|
32685
|
+
e.height = diagramHeight;
|
|
32526
32686
|
e.totalWidth = this.width;
|
|
32527
|
-
e.totalHeight = totalHeight < 0 ? y : totalHeight;
|
|
32687
|
+
e.totalHeight = totalHeight < 0 ? y + diagramHeight : totalHeight;
|
|
32528
32688
|
e.firstMasterBarIndex = -1;
|
|
32529
32689
|
e.lastMasterBarIndex = -1;
|
|
32530
|
-
this.
|
|
32531
|
-
|
|
32690
|
+
this.registerPartial(e, (canvas) => {
|
|
32691
|
+
canvas.color = res.scoreInfoColor;
|
|
32692
|
+
canvas.textAlign = TextAlign.Center;
|
|
32693
|
+
this.chordDiagrams.paint(0, 0, canvas);
|
|
32694
|
+
});
|
|
32695
|
+
return y + diagramHeight;
|
|
32532
32696
|
}
|
|
32533
|
-
layoutAndRenderScoreInfo(
|
|
32697
|
+
layoutAndRenderScoreInfo(y, totalHeight = -1) {
|
|
32534
32698
|
Logger.debug(this.name, 'Layouting score info');
|
|
32699
|
+
const e = new RenderFinishedEventArgs();
|
|
32700
|
+
e.x = 0;
|
|
32701
|
+
e.y = y;
|
|
32702
|
+
let infoHeight = this._pagePadding[1];
|
|
32535
32703
|
let scale = this.scale;
|
|
32536
32704
|
let res = this.renderer.settings.display.resources;
|
|
32537
32705
|
let centeredGlyphs = [
|
|
@@ -32545,9 +32713,9 @@
|
|
|
32545
32713
|
if (this.scoreInfoGlyphs.has(centeredGlyphs[i])) {
|
|
32546
32714
|
let glyph = this.scoreInfoGlyphs.get(centeredGlyphs[i]);
|
|
32547
32715
|
glyph.x = this.width / 2;
|
|
32548
|
-
glyph.y =
|
|
32716
|
+
glyph.y = infoHeight;
|
|
32549
32717
|
glyph.textAlign = TextAlign.Center;
|
|
32550
|
-
|
|
32718
|
+
infoHeight += glyph.font.size * scale;
|
|
32551
32719
|
}
|
|
32552
32720
|
}
|
|
32553
32721
|
let musicOrWords = false;
|
|
@@ -32555,51 +32723,46 @@
|
|
|
32555
32723
|
if (this.scoreInfoGlyphs.has(NotationElement.ScoreMusic)) {
|
|
32556
32724
|
let glyph = this.scoreInfoGlyphs.get(NotationElement.ScoreMusic);
|
|
32557
32725
|
glyph.x = this.width - this._pagePadding[2];
|
|
32558
|
-
glyph.y =
|
|
32726
|
+
glyph.y = infoHeight;
|
|
32559
32727
|
glyph.textAlign = TextAlign.Right;
|
|
32560
32728
|
musicOrWords = true;
|
|
32561
32729
|
musicOrWordsHeight = glyph.font.size * scale;
|
|
32562
32730
|
}
|
|
32563
32731
|
if (this.scoreInfoGlyphs.has(NotationElement.ScoreWords)) {
|
|
32564
32732
|
let glyph = this.scoreInfoGlyphs.get(NotationElement.ScoreWords);
|
|
32565
|
-
glyph.x =
|
|
32566
|
-
glyph.y =
|
|
32733
|
+
glyph.x = this._pagePadding[0];
|
|
32734
|
+
glyph.y = infoHeight;
|
|
32567
32735
|
glyph.textAlign = TextAlign.Left;
|
|
32568
32736
|
musicOrWords = true;
|
|
32569
32737
|
musicOrWordsHeight = glyph.font.size * scale;
|
|
32570
32738
|
}
|
|
32571
32739
|
if (musicOrWords) {
|
|
32572
|
-
|
|
32740
|
+
infoHeight += musicOrWordsHeight;
|
|
32573
32741
|
}
|
|
32574
|
-
|
|
32575
|
-
let canvas = this.renderer.canvas;
|
|
32576
|
-
canvas.beginRender(this.width, y);
|
|
32577
|
-
canvas.color = res.scoreInfoColor;
|
|
32578
|
-
canvas.textAlign = TextAlign.Center;
|
|
32579
|
-
for (const g of this.scoreInfoGlyphs.values()) {
|
|
32580
|
-
g.paint(0, 0, canvas);
|
|
32581
|
-
}
|
|
32582
|
-
let result = canvas.endRender();
|
|
32583
|
-
let e = new RenderFinishedEventArgs();
|
|
32742
|
+
infoHeight = Math.floor(infoHeight + 17 * this.scale);
|
|
32584
32743
|
e.width = this.width;
|
|
32585
|
-
e.height =
|
|
32586
|
-
e.renderResult = result;
|
|
32744
|
+
e.height = infoHeight;
|
|
32587
32745
|
e.totalWidth = this.width;
|
|
32588
|
-
e.totalHeight = totalHeight < 0 ? y : totalHeight;
|
|
32746
|
+
e.totalHeight = totalHeight < 0 ? y + e.height : totalHeight;
|
|
32589
32747
|
e.firstMasterBarIndex = -1;
|
|
32590
32748
|
e.lastMasterBarIndex = -1;
|
|
32591
|
-
this.
|
|
32592
|
-
|
|
32749
|
+
this.registerPartial(e, (canvas) => {
|
|
32750
|
+
canvas.color = res.scoreInfoColor;
|
|
32751
|
+
canvas.textAlign = TextAlign.Center;
|
|
32752
|
+
for (const g of this.scoreInfoGlyphs.values()) {
|
|
32753
|
+
g.paint(0, 0, canvas);
|
|
32754
|
+
}
|
|
32755
|
+
});
|
|
32756
|
+
return y + infoHeight;
|
|
32593
32757
|
}
|
|
32594
|
-
resizeAndRenderScore(
|
|
32595
|
-
let canvas = this.renderer.canvas;
|
|
32758
|
+
resizeAndRenderScore(y, oldHeight) {
|
|
32596
32759
|
// if we have a fixed number of bars per row, we only need to refit them.
|
|
32597
32760
|
if (this.renderer.settings.display.barsPerRow !== -1) {
|
|
32598
32761
|
for (let i = 0; i < this._groups.length; i++) {
|
|
32599
32762
|
let group = this._groups[i];
|
|
32600
32763
|
this.fitGroup(group);
|
|
32601
32764
|
group.finalizeGroup();
|
|
32602
|
-
y += this.paintGroup(group, oldHeight
|
|
32765
|
+
y += this.paintGroup(group, oldHeight);
|
|
32603
32766
|
}
|
|
32604
32767
|
}
|
|
32605
32768
|
else {
|
|
@@ -32608,7 +32771,7 @@
|
|
|
32608
32771
|
let maxWidth = this.maxWidth;
|
|
32609
32772
|
let group = this.createEmptyStaveGroup();
|
|
32610
32773
|
group.index = this._groups.length;
|
|
32611
|
-
group.x =
|
|
32774
|
+
group.x = this._pagePadding[0];
|
|
32612
32775
|
group.y = y;
|
|
32613
32776
|
while (currentIndex < this._allMasterBarRenderers.length) {
|
|
32614
32777
|
// if the current renderer still has space in the current group add it
|
|
@@ -32632,11 +32795,11 @@
|
|
|
32632
32795
|
this._groups.push(group);
|
|
32633
32796
|
this.fitGroup(group);
|
|
32634
32797
|
group.finalizeGroup();
|
|
32635
|
-
y += this.paintGroup(group, oldHeight
|
|
32798
|
+
y += this.paintGroup(group, oldHeight);
|
|
32636
32799
|
// note: we do not increase currentIndex here to have it added to the next group
|
|
32637
32800
|
group = this.createEmptyStaveGroup();
|
|
32638
32801
|
group.index = this._groups.length;
|
|
32639
|
-
group.x =
|
|
32802
|
+
group.x = this._pagePadding[0];
|
|
32640
32803
|
group.y = y;
|
|
32641
32804
|
}
|
|
32642
32805
|
}
|
|
@@ -32644,12 +32807,11 @@
|
|
|
32644
32807
|
// don't forget to finish the last group
|
|
32645
32808
|
this.fitGroup(group);
|
|
32646
32809
|
group.finalizeGroup();
|
|
32647
|
-
y += this.paintGroup(group, oldHeight
|
|
32810
|
+
y += this.paintGroup(group, oldHeight);
|
|
32648
32811
|
}
|
|
32649
32812
|
return y;
|
|
32650
32813
|
}
|
|
32651
|
-
layoutAndRenderScore(
|
|
32652
|
-
let canvas = this.renderer.canvas;
|
|
32814
|
+
layoutAndRenderScore(y) {
|
|
32653
32815
|
let startIndex = this.firstBarIndex;
|
|
32654
32816
|
let currentBarIndex = startIndex;
|
|
32655
32817
|
let endBarIndex = this.lastBarIndex;
|
|
@@ -32658,38 +32820,38 @@
|
|
|
32658
32820
|
// create group and align set proper coordinates
|
|
32659
32821
|
let group = this.createStaveGroup(currentBarIndex, endBarIndex);
|
|
32660
32822
|
this._groups.push(group);
|
|
32661
|
-
group.x =
|
|
32823
|
+
group.x = this._pagePadding[0];
|
|
32662
32824
|
group.y = y;
|
|
32663
32825
|
currentBarIndex = group.lastBarIndex + 1;
|
|
32664
32826
|
// finalize group (sizing etc).
|
|
32665
32827
|
this.fitGroup(group);
|
|
32666
32828
|
group.finalizeGroup();
|
|
32667
32829
|
Logger.debug(this.name, 'Rendering partial from bar ' + group.firstBarIndex + ' to ' + group.lastBarIndex, null);
|
|
32668
|
-
y += this.paintGroup(group, y
|
|
32830
|
+
y += this.paintGroup(group, y);
|
|
32669
32831
|
}
|
|
32670
32832
|
return y;
|
|
32671
32833
|
}
|
|
32672
|
-
paintGroup(group, totalHeight
|
|
32834
|
+
paintGroup(group, totalHeight) {
|
|
32673
32835
|
// paint into canvas
|
|
32674
|
-
let height = group.height + 20 * this.scale;
|
|
32675
|
-
|
|
32676
|
-
|
|
32677
|
-
|
|
32678
|
-
// NOTE: we use this negation trick to make the group paint itself to 0/0 coordinates
|
|
32679
|
-
// since we use partial drawing
|
|
32680
|
-
group.paint(0, -group.y, canvas);
|
|
32681
|
-
// calculate coordinates for next group
|
|
32682
|
-
totalHeight += height;
|
|
32683
|
-
let result = canvas.endRender();
|
|
32684
|
-
let args = new RenderFinishedEventArgs();
|
|
32836
|
+
let height = Math.floor(group.height + 20 * this.scale);
|
|
32837
|
+
const args = new RenderFinishedEventArgs();
|
|
32838
|
+
args.x = 0;
|
|
32839
|
+
args.y = group.y;
|
|
32685
32840
|
args.totalWidth = this.width;
|
|
32686
32841
|
args.totalHeight = totalHeight;
|
|
32687
32842
|
args.width = this.width;
|
|
32688
32843
|
args.height = height;
|
|
32689
|
-
args.renderResult = result;
|
|
32690
32844
|
args.firstMasterBarIndex = group.firstBarIndex;
|
|
32691
32845
|
args.lastMasterBarIndex = group.lastBarIndex;
|
|
32692
|
-
this.
|
|
32846
|
+
this.registerPartial(args, canvas => {
|
|
32847
|
+
this.renderer.canvas.color = this.renderer.settings.display.resources.mainGlyphColor;
|
|
32848
|
+
this.renderer.canvas.textAlign = TextAlign.Left;
|
|
32849
|
+
// NOTE: we use this negation trick to make the group paint itself to 0/0 coordinates
|
|
32850
|
+
// since we use partial drawing
|
|
32851
|
+
group.paint(0, -args.y, canvas);
|
|
32852
|
+
});
|
|
32853
|
+
// calculate coordinates for next group
|
|
32854
|
+
totalHeight += height;
|
|
32693
32855
|
return height;
|
|
32694
32856
|
}
|
|
32695
32857
|
/**
|
|
@@ -32699,7 +32861,6 @@
|
|
|
32699
32861
|
if (group.isFull || group.width > this.maxWidth) {
|
|
32700
32862
|
group.scaleToWidth(this.maxWidth);
|
|
32701
32863
|
}
|
|
32702
|
-
this.width = Math.max(this.width, group.width);
|
|
32703
32864
|
}
|
|
32704
32865
|
createStaveGroup(currentBarIndex, endIndex) {
|
|
32705
32866
|
let group = this.createEmptyStaveGroup();
|
|
@@ -40278,8 +40439,8 @@
|
|
|
40278
40439
|
// </auto-generated>
|
|
40279
40440
|
class VersionInfo {
|
|
40280
40441
|
}
|
|
40281
|
-
VersionInfo.version = '1.3.0-alpha.
|
|
40282
|
-
VersionInfo.date = '2021-
|
|
40442
|
+
VersionInfo.version = '1.3.0-alpha.139';
|
|
40443
|
+
VersionInfo.date = '2021-12-29T17:37:24.580Z';
|
|
40283
40444
|
|
|
40284
40445
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
40285
40446
|
__proto__: null,
|