@coderline/alphatab 1.3.0-alpha.375 → 1.3.0-alpha.387

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,5 +1,5 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.375 (develop, build 375)
2
+ * alphaTab v1.3.0-alpha.387 (develop, build 387)
3
3
  *
4
4
  * Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -21281,6 +21281,12 @@ class BarBounds {
21281
21281
  }
21282
21282
  return beat;
21283
21283
  }
21284
+ /**
21285
+ * Finishes the lookup object and optimizes itself for fast access.
21286
+ */
21287
+ finish() {
21288
+ this.beats.sort((a, b) => a.realBounds.x - b.realBounds.x);
21289
+ }
21284
21290
  }
21285
21291
 
21286
21292
  /**
@@ -21367,10 +21373,14 @@ class MasterBarBounds {
21367
21373
  */
21368
21374
  findBeatAtPos(x, y) {
21369
21375
  let beat = null;
21376
+ let distance = 10000000;
21370
21377
  for (let bar of this.bars) {
21371
21378
  let b = bar.findBeatAtPos(x);
21372
21379
  if (b && (!beat || beat.realBounds.x < b.realBounds.x)) {
21373
- beat = b;
21380
+ const newDistance = Math.abs(b.realBounds.x - x);
21381
+ if (!beat || newDistance < distance) {
21382
+ beat = b;
21383
+ }
21374
21384
  }
21375
21385
  }
21376
21386
  return !beat ? null : beat.beat;
@@ -21394,6 +21404,9 @@ class MasterBarBounds {
21394
21404
  }
21395
21405
  return 0;
21396
21406
  });
21407
+ for (const bar of this.bars) {
21408
+ bar.finish();
21409
+ }
21397
21410
  }
21398
21411
  /**
21399
21412
  * Adds a new beat to the lookup.
@@ -21910,6 +21923,8 @@ class ScoreRenderer {
21910
21923
  this.postRenderFinished.trigger();
21911
21924
  }
21912
21925
  onRenderFinished() {
21926
+ var _a;
21927
+ (_a = this.boundsLookup) === null || _a === void 0 ? void 0 : _a.finish();
21913
21928
  const e = new RenderFinishedEventArgs();
21914
21929
  e.totalHeight = this.layout.height;
21915
21930
  e.totalWidth = this.layout.width;
@@ -22669,6 +22684,11 @@ class MidiTickLookupFindBeatResult {
22669
22684
  * Gets or sets the duration in milliseconds how long this beat is playing.
22670
22685
  */
22671
22686
  this.duration = 0;
22687
+ /**
22688
+ * Gets or sets the duration in midi ticks for how long this tick lookup is valid
22689
+ * starting at the `currentBeatLookup.start`
22690
+ */
22691
+ this.tickDuration = 0;
22672
22692
  /**
22673
22693
  * Gets or sets the beat lookup for the next beat.
22674
22694
  */
@@ -22760,7 +22780,8 @@ class MidiTickLookup {
22760
22780
  return result;
22761
22781
  }
22762
22782
  findBeatFast(trackLookup, currentBeatHint, tick) {
22763
- if (tick >= currentBeatHint.currentBeatLookup.start && tick < currentBeatHint.currentBeatLookup.end) {
22783
+ const end = currentBeatHint.currentBeatLookup.start + currentBeatHint.tickDuration;
22784
+ if (tick >= currentBeatHint.currentBeatLookup.start && tick < end) {
22764
22785
  // still same beat?
22765
22786
  return currentBeatHint;
22766
22787
  }
@@ -22809,9 +22830,8 @@ class MidiTickLookup {
22809
22830
  const result = new MidiTickLookupFindBeatResult();
22810
22831
  result.currentBeatLookup = beat;
22811
22832
  result.nextBeatLookup = nextBeat;
22812
- result.duration = !nextBeat
22813
- ? MidiUtils.ticksToMillis(beat.end - beat.start, beat.masterBar.tempo)
22814
- : MidiUtils.ticksToMillis(nextBeat.start - beat.start, beat.masterBar.tempo);
22833
+ result.tickDuration = !nextBeat ? beat.end - beat.start : nextBeat.start - beat.start;
22834
+ result.duration = MidiUtils.ticksToMillis(result.tickDuration, beat.masterBar.tempo);
22815
22835
  result.beatsToHighlight = beat.beatsToHighlight;
22816
22836
  return result;
22817
22837
  }
@@ -26663,6 +26683,7 @@ class AlphaTabWorkerScoreRenderer {
26663
26683
  break;
26664
26684
  case 'alphaTab.postRenderFinished':
26665
26685
  this.boundsLookup = BoundsLookup.fromJson(data.boundsLookup, this._api.score);
26686
+ this.boundsLookup.finish();
26666
26687
  this.postRenderFinished.trigger();
26667
26688
  break;
26668
26689
  case 'alphaTab.error':
@@ -39367,7 +39388,7 @@ class CapellaParser {
39367
39388
  // after the layout is parsed we can build up the
39368
39389
  // track > staff structure for later use
39369
39390
  // curly brackets define which staves go together into a track
39370
- const curlyBrackets = this._brackets.filter(b => b.curly);
39391
+ const curlyBrackets = this._brackets.filter(b => !!b.curly);
39371
39392
  curlyBrackets.sort((a, b) => a.from - b.from);
39372
39393
  let currentBracketIndex = 0;
39373
39394
  let currentTrack = null;
@@ -41108,8 +41129,8 @@ class CoreSettings {
41108
41129
  // </auto-generated>
41109
41130
  class VersionInfo {
41110
41131
  }
41111
- VersionInfo.version = '1.3.0-alpha.375';
41112
- VersionInfo.date = '2022-08-29T00:57:33.607Z';
41132
+ VersionInfo.version = '1.3.0-alpha.387';
41133
+ VersionInfo.date = '2022-09-10T01:00:00.369Z';
41113
41134
 
41114
41135
  var index$5 = /*#__PURE__*/Object.freeze({
41115
41136
  __proto__: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderline/alphatab",
3
- "version": "1.3.0-alpha.375",
3
+ "version": "1.3.0-alpha.387",
4
4
  "description": "alphaTab is a music notation and guitar tablature rendering library",
5
5
  "keywords": [
6
6
  "guitar",
@@ -84,7 +84,7 @@
84
84
  "tslint-config-prettier": "^1.18.0",
85
85
  "tslint-config-standard": "^9.0.0",
86
86
  "ttypescript": "^1.5.13",
87
- "typescript": "^4.7.2"
87
+ "typescript": "^4.8.3"
88
88
  },
89
89
  "files": [
90
90
  "/dist/alphaTab.js",