@coderline/alphatab 1.3.0-alpha.140 → 1.3.0-alpha.144

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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.140 (develop, build 140)
2
+ * alphaTab v1.3.0-alpha.144 (develop, build 144)
3
3
  *
4
- * Copyright © 2021, Daniel Kuschny and Contributors, All rights reserved.
4
+ * Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
6
6
  * This Source Code Form is subject to the terms of the Mozilla Public
7
7
  * License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -4579,7 +4579,12 @@ class Score {
4579
4579
  if (this.masterBars.length !== 0) {
4580
4580
  bar.previousMasterBar = this.masterBars[this.masterBars.length - 1];
4581
4581
  bar.previousMasterBar.nextMasterBar = bar;
4582
- bar.start = bar.previousMasterBar.start + bar.previousMasterBar.calculateDuration();
4582
+ // TODO: this will not work on anacrusis. Correct anacrusis durations are only working
4583
+ // when there are beats with playback positions already computed which requires full finish
4584
+ // chicken-egg problem here. temporarily forcing anacrusis length here to 0
4585
+ bar.start =
4586
+ bar.previousMasterBar.start +
4587
+ (bar.previousMasterBar.isAnacrusis ? 0 : bar.previousMasterBar.calculateDuration());
4583
4588
  }
4584
4589
  // if the group is closed only the next upcoming header can
4585
4590
  // reopen the group in case of a repeat alternative, so we
@@ -14405,7 +14410,7 @@ class MidiSequencerState {
14405
14410
  this.firstTimeSignatureNumerator = 0;
14406
14411
  this.firstTimeSignatureDenominator = 0;
14407
14412
  this.synthData = [];
14408
- this.division = 0;
14413
+ this.division = MidiUtils.QuarterTime;
14409
14414
  this.eventIndex = 0;
14410
14415
  this.currentTime = 0;
14411
14416
  this.playbackRange = null;
@@ -14915,13 +14920,12 @@ class Hydra {
14915
14920
  const samples = new Float32Array(samplesLeft);
14916
14921
  let samplesPos = 0;
14917
14922
  const sampleBuffer = new Uint8Array(2048);
14918
- const testBuffer = new Int16Array((sampleBuffer.length / 2) | 0);
14919
14923
  while (samplesLeft > 0) {
14920
14924
  let samplesToRead = Math.min(samplesLeft, (sampleBuffer.length / 2) | 0);
14921
14925
  reader.read(sampleBuffer, 0, samplesToRead * 2);
14922
14926
  for (let i = 0; i < samplesToRead; i++) {
14923
- testBuffer[i] = (sampleBuffer[i * 2 + 1] << 8) | sampleBuffer[i * 2];
14924
- samples[samplesPos + i] = testBuffer[i] / 32767;
14927
+ const shortSample = TypeConversions.int32ToInt16((sampleBuffer[i * 2 + 1] << 8) | sampleBuffer[i * 2]);
14928
+ samples[samplesPos + i] = shortSample / 32767;
14925
14929
  }
14926
14930
  samplesLeft -= samplesToRead;
14927
14931
  samplesPos += samplesToRead;
@@ -21507,6 +21511,9 @@ class ScoreRenderer {
21507
21511
  this.canvas = null;
21508
21512
  this.score = null;
21509
21513
  this.tracks = null;
21514
+ /**
21515
+ * @internal
21516
+ */
21510
21517
  this.layout = null;
21511
21518
  this.boundsLookup = null;
21512
21519
  this.width = 0;
@@ -24033,6 +24040,7 @@ class AlphaTabApiBase {
24033
24040
  this._previousTick = 0;
24034
24041
  this._playerState = PlayerState.Paused;
24035
24042
  this._currentBeat = null;
24043
+ this._currentBarBounds = null;
24036
24044
  this._previousStateForCursor = PlayerState.Paused;
24037
24045
  this._previousCursorCache = null;
24038
24046
  this._lastScroll = 0;
@@ -24635,7 +24643,7 @@ class AlphaTabApiBase {
24635
24643
  this._playerState = PlayerState.Paused;
24636
24644
  // we need to update our position caches if we render a tablature
24637
24645
  this.renderer.postRenderFinished.on(() => {
24638
- this.cursorUpdateTick(this._previousTick, false);
24646
+ this.cursorUpdateTick(this._previousTick, false, this._previousTick > 10);
24639
24647
  });
24640
24648
  if (this.player) {
24641
24649
  this.player.positionChanged.on(e => {
@@ -24662,15 +24670,16 @@ class AlphaTabApiBase {
24662
24670
  * updates the cursors to highlight the beat at the specified tick position
24663
24671
  * @param tick
24664
24672
  * @param stop
24673
+ * @param shouldScroll whether we should scroll to the bar (if scrolling is active)
24665
24674
  */
24666
- cursorUpdateTick(tick, stop) {
24675
+ cursorUpdateTick(tick, stop, shouldScroll = false) {
24667
24676
  let cache = this._tickCache;
24668
24677
  if (cache) {
24669
24678
  let tracks = this.tracks;
24670
24679
  if (tracks.length > 0) {
24671
24680
  let beat = cache.findBeat(tracks, tick, this._currentBeat);
24672
24681
  if (beat) {
24673
- this.cursorUpdateBeat(beat, stop);
24682
+ this.cursorUpdateBeat(beat, stop, shouldScroll);
24674
24683
  }
24675
24684
  }
24676
24685
  }
@@ -24678,7 +24687,7 @@ class AlphaTabApiBase {
24678
24687
  /**
24679
24688
  * updates the cursors to highlight the specified beat
24680
24689
  */
24681
- cursorUpdateBeat(lookupResult, stop) {
24690
+ cursorUpdateBeat(lookupResult, stop, shouldScroll) {
24682
24691
  const beat = lookupResult.currentBeat;
24683
24692
  const nextBeat = lookupResult.nextBeat;
24684
24693
  const duration = lookupResult.duration;
@@ -24693,9 +24702,6 @@ class AlphaTabApiBase {
24693
24702
  let previousBeat = this._currentBeat;
24694
24703
  let previousCache = this._previousCursorCache;
24695
24704
  let previousState = this._previousStateForCursor;
24696
- this._currentBeat = lookupResult;
24697
- this._previousCursorCache = cache;
24698
- this._previousStateForCursor = this._playerState;
24699
24705
  if (beat === (previousBeat === null || previousBeat === void 0 ? void 0 : previousBeat.currentBeat) && cache === previousCache && previousState === this._playerState) {
24700
24706
  return;
24701
24707
  }
@@ -24703,15 +24709,81 @@ class AlphaTabApiBase {
24703
24709
  if (!beatBoundings) {
24704
24710
  return;
24705
24711
  }
24712
+ // only if we really found some bounds we remember the beat and cache we used to
24713
+ // actually show the cursor
24714
+ this._currentBeat = lookupResult;
24715
+ this._previousCursorCache = cache;
24716
+ this._previousStateForCursor = this._playerState;
24706
24717
  this.uiFacade.beginInvoke(() => {
24707
- this.internalCursorUpdateBeat(beat, nextBeat, duration, stop, beatsToHighlight, cache, beatBoundings);
24718
+ this.internalCursorUpdateBeat(beat, nextBeat, duration, stop, beatsToHighlight, cache, beatBoundings, shouldScroll);
24708
24719
  });
24709
24720
  }
24710
- internalCursorUpdateBeat(beat, nextBeat, duration, stop, beatsToHighlight, cache, beatBoundings) {
24721
+ /**
24722
+ * Initiates a scroll to the cursor
24723
+ */
24724
+ scrollToCursor() {
24725
+ const barBounds = this._currentBarBounds;
24726
+ if (barBounds) {
24727
+ this.internalScrollToCursor(barBounds);
24728
+ }
24729
+ }
24730
+ internalScrollToCursor(barBoundings) {
24731
+ let scrollElement = this.uiFacade.getScrollContainer();
24732
+ let isVertical = Environment.getLayoutEngineFactory(this.settings.display.layoutMode).vertical;
24733
+ let mode = this.settings.player.scrollMode;
24734
+ if (isVertical) {
24735
+ // when scrolling on the y-axis, we preliminary check if the new beat/bar have
24736
+ // moved on the y-axis
24737
+ let y = barBoundings.realBounds.y + this.settings.player.scrollOffsetY;
24738
+ if (y !== this._lastScroll) {
24739
+ this._lastScroll = y;
24740
+ switch (mode) {
24741
+ case ScrollMode.Continuous:
24742
+ let elementOffset = this.uiFacade.getOffset(scrollElement, this.container);
24743
+ this.uiFacade.scrollToY(scrollElement, elementOffset.y + y, this.settings.player.scrollSpeed);
24744
+ break;
24745
+ case ScrollMode.OffScreen:
24746
+ let elementBottom = scrollElement.scrollTop + this.uiFacade.getOffset(null, scrollElement).h;
24747
+ if (barBoundings.visualBounds.y + barBoundings.visualBounds.h >= elementBottom ||
24748
+ barBoundings.visualBounds.y < scrollElement.scrollTop) {
24749
+ let scrollTop = barBoundings.realBounds.y + this.settings.player.scrollOffsetY;
24750
+ this.uiFacade.scrollToY(scrollElement, scrollTop, this.settings.player.scrollSpeed);
24751
+ }
24752
+ break;
24753
+ }
24754
+ }
24755
+ }
24756
+ else {
24757
+ // when scrolling on the x-axis, we preliminary check if the new bar has
24758
+ // moved on the x-axis
24759
+ let x = barBoundings.visualBounds.x;
24760
+ if (x !== this._lastScroll) {
24761
+ this._lastScroll = x;
24762
+ switch (mode) {
24763
+ case ScrollMode.Continuous:
24764
+ let scrollLeftContinuous = barBoundings.realBounds.x + this.settings.player.scrollOffsetX;
24765
+ this._lastScroll = barBoundings.visualBounds.x;
24766
+ this.uiFacade.scrollToX(scrollElement, scrollLeftContinuous, this.settings.player.scrollSpeed);
24767
+ break;
24768
+ case ScrollMode.OffScreen:
24769
+ let elementRight = scrollElement.scrollLeft + this.uiFacade.getOffset(null, scrollElement).w;
24770
+ if (barBoundings.visualBounds.x + barBoundings.visualBounds.w >= elementRight ||
24771
+ barBoundings.visualBounds.x < scrollElement.scrollLeft) {
24772
+ let scrollLeftOffScreen = barBoundings.realBounds.x + this.settings.player.scrollOffsetX;
24773
+ this._lastScroll = barBoundings.visualBounds.x;
24774
+ this.uiFacade.scrollToX(scrollElement, scrollLeftOffScreen, this.settings.player.scrollSpeed);
24775
+ }
24776
+ break;
24777
+ }
24778
+ }
24779
+ }
24780
+ }
24781
+ internalCursorUpdateBeat(beat, nextBeat, duration, stop, beatsToHighlight, cache, beatBoundings, shouldScroll) {
24711
24782
  let barCursor = this._barCursor;
24712
24783
  let beatCursor = this._beatCursor;
24713
24784
  let barBoundings = beatBoundings.barBounds.masterBarBounds;
24714
24785
  let barBounds = barBoundings.visualBounds;
24786
+ this._currentBarBounds = barBoundings;
24715
24787
  barCursor.setBounds(barBounds.x, barBounds.y, barBounds.w, barBounds.h);
24716
24788
  // move beat to start position immediately
24717
24789
  if (this.settings.player.enableAnimatedBeatCursor) {
@@ -24722,90 +24794,45 @@ class AlphaTabApiBase {
24722
24794
  if (this.settings.player.enableElementHighlighting) {
24723
24795
  this.uiFacade.removeHighlights();
24724
24796
  }
24725
- if (this._playerState === PlayerState.Playing || stop) {
24726
- duration /= this.playbackSpeed;
24727
- if (!stop) {
24728
- if (this.settings.player.enableElementHighlighting && beatsToHighlight) {
24729
- for (let highlight of beatsToHighlight) {
24730
- let className = BeatContainerGlyph.getGroupId(highlight);
24731
- this.uiFacade.highlightElements(className, beat.voice.bar.index);
24732
- }
24733
- }
24734
- if (this.settings.player.enableAnimatedBeatCursor) {
24735
- let nextBeatX = barBoundings.visualBounds.x + barBoundings.visualBounds.w;
24736
- // get position of next beat on same stavegroup
24737
- if (nextBeat) {
24738
- // if we are moving within the same bar or to the next bar
24739
- // transition to the next beat, otherwise transition to the end of the bar.
24740
- if ((nextBeat.voice.bar.index === beat.voice.bar.index && nextBeat.index > beat.index) ||
24741
- nextBeat.voice.bar.index === beat.voice.bar.index + 1) {
24742
- let nextBeatBoundings = cache.findBeat(nextBeat);
24743
- if (nextBeatBoundings &&
24744
- nextBeatBoundings.barBounds.masterBarBounds.staveGroupBounds ===
24745
- barBoundings.staveGroupBounds) {
24746
- nextBeatX = nextBeatBoundings.visualBounds.x;
24747
- }
24748
- }
24749
- }
24750
- // we need to put the transition to an own animation frame
24751
- // otherwise the stop animation above is not applied.
24752
- this.uiFacade.beginInvoke(() => {
24753
- beatCursor.transitionToX(duration, nextBeatX);
24754
- });
24755
- }
24756
- }
24757
- if (!this._beatMouseDown && this.settings.player.scrollMode !== ScrollMode.Off) {
24758
- let scrollElement = this.uiFacade.getScrollContainer();
24759
- let isVertical = Environment.getLayoutEngineFactory(this.settings.display.layoutMode).vertical;
24760
- let mode = this.settings.player.scrollMode;
24761
- if (isVertical) {
24762
- // when scrolling on the y-axis, we preliminary check if the new beat/bar have
24763
- // moved on the y-axis
24764
- let y = barBoundings.realBounds.y + this.settings.player.scrollOffsetY;
24765
- if (y !== this._lastScroll) {
24766
- this._lastScroll = y;
24767
- switch (mode) {
24768
- case ScrollMode.Continuous:
24769
- let elementOffset = this.uiFacade.getOffset(scrollElement, this.container);
24770
- this.uiFacade.scrollToY(scrollElement, elementOffset.y + y, this.settings.player.scrollSpeed);
24771
- break;
24772
- case ScrollMode.OffScreen:
24773
- let elementBottom = scrollElement.scrollTop + this.uiFacade.getOffset(null, scrollElement).h;
24774
- if (barBoundings.visualBounds.y + barBoundings.visualBounds.h >= elementBottom ||
24775
- barBoundings.visualBounds.y < scrollElement.scrollTop) {
24776
- let scrollTop = barBoundings.realBounds.y + this.settings.player.scrollOffsetY;
24777
- this.uiFacade.scrollToY(scrollElement, scrollTop, this.settings.player.scrollSpeed);
24778
- }
24779
- break;
24780
- }
24781
- }
24782
- }
24783
- else {
24784
- // when scrolling on the x-axis, we preliminary check if the new bar has
24785
- // moved on the x-axis
24786
- let x = barBoundings.visualBounds.x;
24787
- if (x !== this._lastScroll) {
24788
- this._lastScroll = x;
24789
- switch (mode) {
24790
- case ScrollMode.Continuous:
24791
- let scrollLeftContinuous = barBoundings.realBounds.x + this.settings.player.scrollOffsetX;
24792
- this._lastScroll = barBoundings.visualBounds.x;
24793
- this.uiFacade.scrollToX(scrollElement, scrollLeftContinuous, this.settings.player.scrollSpeed);
24794
- break;
24795
- case ScrollMode.OffScreen:
24796
- let elementRight = scrollElement.scrollLeft + this.uiFacade.getOffset(null, scrollElement).w;
24797
- if (barBoundings.visualBounds.x + barBoundings.visualBounds.w >= elementRight ||
24798
- barBoundings.visualBounds.x < scrollElement.scrollLeft) {
24799
- let scrollLeftOffScreen = barBoundings.realBounds.x + this.settings.player.scrollOffsetX;
24800
- this._lastScroll = barBoundings.visualBounds.x;
24801
- this.uiFacade.scrollToX(scrollElement, scrollLeftOffScreen, this.settings.player.scrollSpeed);
24802
- }
24803
- break;
24797
+ // actively playing? -> animate cursor and highlight items
24798
+ let shouldNotifyBeatChange = false;
24799
+ if (this._playerState === PlayerState.Playing && !stop) {
24800
+ if (this.settings.player.enableElementHighlighting && beatsToHighlight) {
24801
+ for (let highlight of beatsToHighlight) {
24802
+ let className = BeatContainerGlyph.getGroupId(highlight);
24803
+ this.uiFacade.highlightElements(className, beat.voice.bar.index);
24804
+ }
24805
+ }
24806
+ if (this.settings.player.enableAnimatedBeatCursor) {
24807
+ let nextBeatX = barBoundings.visualBounds.x + barBoundings.visualBounds.w;
24808
+ // get position of next beat on same stavegroup
24809
+ if (nextBeat) {
24810
+ // if we are moving within the same bar or to the next bar
24811
+ // transition to the next beat, otherwise transition to the end of the bar.
24812
+ if ((nextBeat.voice.bar.index === beat.voice.bar.index && nextBeat.index > beat.index) ||
24813
+ nextBeat.voice.bar.index === beat.voice.bar.index + 1) {
24814
+ let nextBeatBoundings = cache.findBeat(nextBeat);
24815
+ if (nextBeatBoundings &&
24816
+ nextBeatBoundings.barBounds.masterBarBounds.staveGroupBounds ===
24817
+ barBoundings.staveGroupBounds) {
24818
+ nextBeatX = nextBeatBoundings.visualBounds.x;
24804
24819
  }
24805
24820
  }
24806
24821
  }
24822
+ // we need to put the transition to an own animation frame
24823
+ // otherwise the stop animation above is not applied.
24824
+ this.uiFacade.beginInvoke(() => {
24825
+ beatCursor.transitionToX(duration / this.playbackSpeed, nextBeatX);
24826
+ });
24807
24827
  }
24808
- // trigger an event for others to indicate which beat/bar is played
24828
+ shouldScroll = !stop;
24829
+ shouldNotifyBeatChange = true;
24830
+ }
24831
+ if (shouldScroll && !this._beatMouseDown && this.settings.player.scrollMode !== ScrollMode.Off) {
24832
+ this.internalScrollToCursor(barBoundings);
24833
+ }
24834
+ // trigger an event for others to indicate which beat/bar is played
24835
+ if (shouldNotifyBeatChange) {
24809
24836
  this.onPlayedBeatChanged(beat);
24810
24837
  }
24811
24838
  }
@@ -25112,8 +25139,10 @@ class AlphaTabApiBase {
25112
25139
  if (this._isDestroyed) {
25113
25140
  return;
25114
25141
  }
25115
- this.playerPositionChanged.trigger(e);
25116
- this.uiFacade.triggerEvent(this.container, 'playerPositionChanged', e);
25142
+ if (this.score !== null && this.tracks.length > 0) {
25143
+ this.playerPositionChanged.trigger(e);
25144
+ this.uiFacade.triggerEvent(this.container, 'playerPositionChanged', e);
25145
+ }
25117
25146
  }
25118
25147
  onMidiEventsPlayed(e) {
25119
25148
  if (this._isDestroyed) {
@@ -26574,6 +26603,7 @@ class BrowserUiFacade {
26574
26603
  canvasElement.style.fontSize = '0';
26575
26604
  canvasElement.style.overflow = 'hidden';
26576
26605
  canvasElement.style.lineHeight = '0';
26606
+ canvasElement.style.position = 'relative';
26577
26607
  return new HtmlElementContainer(canvasElement);
26578
26608
  }
26579
26609
  triggerEvent(container, name, details = null, originalEvent) {
@@ -32036,7 +32066,6 @@ class StaveGroup {
32036
32066
  this.paintPartial(cx + this.x, cy + this.y, canvas, 0, this.masterBarsRenderers.length);
32037
32067
  }
32038
32068
  paintPartial(cx, cy, canvas, startIndex, count) {
32039
- this.buildBoundingsLookup(cx, cy);
32040
32069
  for (let i = 0, j = this._allStaves.length; i < j; i++) {
32041
32070
  this._allStaves[i].paint(cx, cy, canvas, startIndex, count);
32042
32071
  }
@@ -32294,7 +32323,7 @@ class LazyPartial {
32294
32323
  }
32295
32324
  }
32296
32325
  /**
32297
- * This is the base public class for creating new layouting engines for the score renderer.
32326
+ * This is the base class for creating new layouting engines for the score renderer.
32298
32327
  */
32299
32328
  class ScoreLayout {
32300
32329
  constructor(renderer) {
@@ -32508,7 +32537,7 @@ class ScoreLayout {
32508
32537
  : this.firstBarX;
32509
32538
  e.y = y;
32510
32539
  e.totalWidth = this.width;
32511
- e.totalHeight = this.height;
32540
+ e.totalHeight = y + height;
32512
32541
  e.firstMasterBarIndex = -1;
32513
32542
  e.lastMasterBarIndex = -1;
32514
32543
  this.registerPartial(e, canvas => {
@@ -32523,6 +32552,7 @@ class ScoreLayout {
32523
32552
 
32524
32553
  class HorizontalScreenLayoutPartialInfo {
32525
32554
  constructor() {
32555
+ this.x = 0;
32526
32556
  this.width = 0;
32527
32557
  this.masterBars = [];
32528
32558
  }
@@ -32591,6 +32621,7 @@ class HorizontalScreenLayout extends ScoreLayout {
32591
32621
  let countPerPartial = this.renderer.settings.display.barCountPerPartial;
32592
32622
  let partials = [];
32593
32623
  let currentPartial = new HorizontalScreenLayoutPartialInfo();
32624
+ let renderX = 0;
32594
32625
  while (currentBarIndex <= endBarIndex) {
32595
32626
  let result = this._group.addBars(this.renderer.tracks, currentBarIndex);
32596
32627
  if (result) {
@@ -32600,6 +32631,8 @@ class HorizontalScreenLayout extends ScoreLayout {
32600
32631
  let previousPartial = partials[partials.length - 1];
32601
32632
  previousPartial.masterBars.push(score.masterBars[currentBarIndex]);
32602
32633
  previousPartial.width += result.width;
32634
+ renderX += result.width;
32635
+ currentPartial.x += renderX;
32603
32636
  }
32604
32637
  else {
32605
32638
  currentPartial.masterBars.push(score.masterBars[currentBarIndex]);
@@ -32607,14 +32640,17 @@ class HorizontalScreenLayout extends ScoreLayout {
32607
32640
  // no targetPartial here because previous partials already handled this code
32608
32641
  if (currentPartial.masterBars.length >= countPerPartial) {
32609
32642
  if (partials.length === 0) {
32610
- currentPartial.width += this._group.x + this._group.accoladeSpacing;
32643
+ // respect accolade and on first partial
32644
+ currentPartial.width += this._group.accoladeSpacing + this._pagePadding[0];
32611
32645
  }
32646
+ renderX += currentPartial.width;
32612
32647
  partials.push(currentPartial);
32613
32648
  Logger.debug(this.name, 'Finished partial from bar ' +
32614
32649
  currentPartial.masterBars[0].index +
32615
32650
  ' to ' +
32616
32651
  currentPartial.masterBars[currentPartial.masterBars.length - 1].index, null);
32617
32652
  currentPartial = new HorizontalScreenLayoutPartialInfo();
32653
+ currentPartial.x = renderX;
32618
32654
  }
32619
32655
  }
32620
32656
  }
@@ -32623,7 +32659,7 @@ class HorizontalScreenLayout extends ScoreLayout {
32623
32659
  // don't miss the last partial if not empty
32624
32660
  if (currentPartial.masterBars.length > 0) {
32625
32661
  if (partials.length === 0) {
32626
- currentPartial.width += this._group.x + this._group.accoladeSpacing;
32662
+ currentPartial.width += this._group.accoladeSpacing + this._pagePadding[0];
32627
32663
  }
32628
32664
  partials.push(currentPartial);
32629
32665
  Logger.debug(this.name, 'Finished partial from bar ' +
@@ -32637,7 +32673,7 @@ class HorizontalScreenLayout extends ScoreLayout {
32637
32673
  currentBarIndex = 0;
32638
32674
  let x = 0;
32639
32675
  for (let i = 0; i < partials.length; i++) {
32640
- let partial = partials[i];
32676
+ const partial = partials[i];
32641
32677
  const e = new RenderFinishedEventArgs();
32642
32678
  e.x = x;
32643
32679
  e.y = 0;
@@ -32648,14 +32684,19 @@ class HorizontalScreenLayout extends ScoreLayout {
32648
32684
  e.firstMasterBarIndex = partial.masterBars[0].index;
32649
32685
  e.lastMasterBarIndex = partial.masterBars[partial.masterBars.length - 1].index;
32650
32686
  x += partial.width;
32687
+ // pull to local scope for lambda
32651
32688
  const partialBarIndex = currentBarIndex;
32689
+ const partialIndex = i;
32690
+ this._group.buildBoundingsLookup(this._group.x, this._group.y);
32652
32691
  this.registerPartial(e, canvas => {
32653
32692
  canvas.color = this.renderer.settings.display.resources.mainGlyphColor;
32654
32693
  canvas.textAlign = TextAlign.Left;
32655
32694
  let renderX = this._group.getBarX(partial.masterBars[0].index) + this._group.accoladeSpacing;
32656
- if (i === 0) {
32695
+ if (partialIndex === 0) {
32657
32696
  renderX -= this._group.x + this._group.accoladeSpacing;
32658
32697
  }
32698
+ canvas.color = this.renderer.settings.display.resources.mainGlyphColor;
32699
+ canvas.textAlign = TextAlign.Left;
32659
32700
  Logger.debug(this.name, 'Rendering partial from bar ' +
32660
32701
  partial.masterBars[0].index +
32661
32702
  ' to ' +
@@ -32950,6 +32991,7 @@ class PageViewLayout extends ScoreLayout {
32950
32991
  args.height = height;
32951
32992
  args.firstMasterBarIndex = group.firstBarIndex;
32952
32993
  args.lastMasterBarIndex = group.lastBarIndex;
32994
+ group.buildBoundingsLookup(0, 0);
32953
32995
  this.registerPartial(args, canvas => {
32954
32996
  this.renderer.canvas.color = this.renderer.settings.display.resources.mainGlyphColor;
32955
32997
  this.renderer.canvas.textAlign = TextAlign.Left;
@@ -40102,23 +40144,25 @@ class Environment {
40102
40144
  * @target web
40103
40145
  */
40104
40146
  static detectScriptFile() {
40105
- // normal browser include as <script>
40106
- if ('document' in Environment.globalThis && document.currentScript) {
40107
- return document.currentScript.src;
40108
- }
40109
40147
  // browser include as ES6 import
40110
40148
  // <script type="module">
40111
40149
  // import * as alphaTab from 'dist/alphaTab.js';
40112
40150
  try {
40113
40151
  // @ts-ignore
40114
- const meta = import.meta;
40115
- if ('url' in meta) {
40116
- return meta.url;
40152
+ const importUrl = import.meta.url;
40153
+ // avoid using file:// urls in case of
40154
+ // bundlers like webpack
40155
+ if (importUrl && importUrl.indexOf('file://') === -1) {
40156
+ return importUrl;
40117
40157
  }
40118
40158
  }
40119
40159
  catch (e) {
40120
40160
  // ignore potential errors
40121
40161
  }
40162
+ // normal browser include as <script>
40163
+ if ('document' in Environment.globalThis && document.currentScript) {
40164
+ return document.currentScript.src;
40165
+ }
40122
40166
  return null;
40123
40167
  }
40124
40168
  /**
@@ -40546,8 +40590,8 @@ class CoreSettings {
40546
40590
  // </auto-generated>
40547
40591
  class VersionInfo {
40548
40592
  }
40549
- VersionInfo.version = '1.3.0-alpha.140';
40550
- VersionInfo.date = '2021-12-29T23:06:43.677Z';
40593
+ VersionInfo.version = '1.3.0-alpha.144';
40594
+ VersionInfo.date = '2022-01-16T17:33:59.910Z';
40551
40595
 
40552
40596
  var index$5 = /*#__PURE__*/Object.freeze({
40553
40597
  __proto__: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderline/alphatab",
3
- "version": "1.3.0-alpha.140",
3
+ "version": "1.3.0-alpha.144",
4
4
  "description": "alphaTab is a music notation and guitar tablature rendering library",
5
5
  "keywords": [
6
6
  "guitar",