@coderline/alphatab 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alphaTab.core.min.mjs +2 -2
- package/dist/alphaTab.core.mjs +618 -355
- package/dist/alphaTab.d.ts +131 -4
- package/dist/alphaTab.js +618 -355
- package/dist/alphaTab.min.js +2 -2
- package/dist/alphaTab.min.mjs +1 -1
- package/dist/alphaTab.mjs +1 -1
- package/dist/alphaTab.worker.min.mjs +1 -1
- package/dist/alphaTab.worker.mjs +1 -1
- package/dist/alphaTab.worklet.min.mjs +1 -1
- package/dist/alphaTab.worklet.mjs +1 -1
- package/package.json +1 -1
package/dist/alphaTab.d.ts
CHANGED
|
@@ -365,6 +365,8 @@ export declare class AlphaTabApiBase<TSettings> {
|
|
|
365
365
|
private _player;
|
|
366
366
|
private _renderer;
|
|
367
367
|
private _defaultScrollHandler?;
|
|
368
|
+
private _defaultCursorHandler?;
|
|
369
|
+
private _customCursorHandler?;
|
|
368
370
|
/**
|
|
369
371
|
* An indicator by how many midi-ticks the song contents are shifted.
|
|
370
372
|
* Grace beats at start might require a shift for the first beat to start at 0.
|
|
@@ -839,6 +841,62 @@ export declare class AlphaTabApiBase<TSettings> {
|
|
|
839
841
|
* ```
|
|
840
842
|
*/
|
|
841
843
|
render(renderHints?: RenderHints): void;
|
|
844
|
+
/**
|
|
845
|
+
* A custom cursor handler which will be used to update the cursor positions during playback.
|
|
846
|
+
*
|
|
847
|
+
* @category Properties - Player
|
|
848
|
+
* @since 1.8.1
|
|
849
|
+
* @example
|
|
850
|
+
* JavaScript
|
|
851
|
+
* ```js
|
|
852
|
+
* const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
|
|
853
|
+
* api.customCursorHandler = {
|
|
854
|
+
* _customAdorner: undefined,
|
|
855
|
+
* onAttach(cursors) {
|
|
856
|
+
* this._customAdorner = document.createElement('div');
|
|
857
|
+
* this._customAdorner.classList.add('cursor-adorner');
|
|
858
|
+
* cursors.cursorWrapper.element.appendChild(this._customAdorner);
|
|
859
|
+
* },
|
|
860
|
+
* onDetach(cursors) { this._customAdorner.remove(); },
|
|
861
|
+
* placeBarCursor(barCursor, beatBounds) {
|
|
862
|
+
* const barBoundings = beatBounds.barBounds.masterBarBounds;
|
|
863
|
+
* const barBounds = barBoundings.visualBounds;
|
|
864
|
+
* barCursor.setBounds(barBounds.x, barBounds.y, barBounds.w, barBounds.h);
|
|
865
|
+
* },
|
|
866
|
+
* placeBeatCursor(beatCursor, beatBounds, startBeatX) {
|
|
867
|
+
* const barBoundings = beatBounds.barBounds.masterBarBounds;
|
|
868
|
+
* const barBounds = barBoundings.visualBounds;
|
|
869
|
+
* beatCursor.transitionToX(0, startBeatX);
|
|
870
|
+
* beatCursor.setBounds(startBeatX, barBounds.y, 1, barBounds.h);
|
|
871
|
+
* this._customAdorner.style.left = startBeatX + 'px';
|
|
872
|
+
* this._customAdorner.style.top = (barBounds.y - 10) + 'px';
|
|
873
|
+
* this._customAdorner.style.width = '1px';
|
|
874
|
+
* this._customAdorner.style.height = '10px';
|
|
875
|
+
* this._customAdorner.style.transition = 'left 0ms linear'; // stop animation
|
|
876
|
+
* },
|
|
877
|
+
* transitionBeatCursor(beatCursor, beatBounds, startBeatX, endBeatX, duration, cursorMode) {
|
|
878
|
+
* this._customAdorner.style.transition = `left ${duration}ms linear`; // start animation
|
|
879
|
+
* this._customAdorner.style.left = endBeatX + 'px';
|
|
880
|
+
* }
|
|
881
|
+
* }
|
|
882
|
+
* ```
|
|
883
|
+
*
|
|
884
|
+
* @example
|
|
885
|
+
* C#
|
|
886
|
+
* ```cs
|
|
887
|
+
* var api = new AlphaTabApi<MyControl>(...);
|
|
888
|
+
* api.CustomCursorHandler = new CustomCursorHandler();
|
|
889
|
+
* ```
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* Android
|
|
893
|
+
* ```kotlin
|
|
894
|
+
* val api = AlphaTabApi<MyControl>(...)
|
|
895
|
+
* api.customCursorHandler = CustomCursorHandler();
|
|
896
|
+
* ```
|
|
897
|
+
*/
|
|
898
|
+
get customCursorHandler(): ICursorHandler | undefined;
|
|
899
|
+
set customCursorHandler(value: ICursorHandler | undefined);
|
|
842
900
|
private _tickCache;
|
|
843
901
|
/**
|
|
844
902
|
* A custom scroll handler which will be used to handle scrolling operations during playback.
|
|
@@ -1686,6 +1744,8 @@ export declare class AlphaTabApiBase<TSettings> {
|
|
|
1686
1744
|
private _destroyCursors;
|
|
1687
1745
|
private _createCursors;
|
|
1688
1746
|
private _updateCursors;
|
|
1747
|
+
private _cursorHandlerMode;
|
|
1748
|
+
private _updateCursorHandler;
|
|
1689
1749
|
private _scrollHandlerMode;
|
|
1690
1750
|
private _scrollHandlerVertical;
|
|
1691
1751
|
private _updateScrollHandler;
|
|
@@ -9283,6 +9343,50 @@ declare interface IContainer {
|
|
|
9283
9343
|
mouseUp: IEventEmitterOfT<IMouseEventArgs>;
|
|
9284
9344
|
}
|
|
9285
9345
|
|
|
9346
|
+
/**
|
|
9347
|
+
* Classes implementing this interface can handle the cursor placement logic
|
|
9348
|
+
* as the playback in alphaTab progresses.
|
|
9349
|
+
*
|
|
9350
|
+
* @public
|
|
9351
|
+
*/
|
|
9352
|
+
declare interface ICursorHandler {
|
|
9353
|
+
/**
|
|
9354
|
+
* Called when this handler activates. This can be on dynamic cursor creation
|
|
9355
|
+
* or when setting a custom handler with cursors already created.
|
|
9356
|
+
* @param cursors A container holding information about the cursor elements.
|
|
9357
|
+
*/
|
|
9358
|
+
onAttach(cursors: Cursors): void;
|
|
9359
|
+
/**
|
|
9360
|
+
* Called when this handler deactivates. This can be on dynamic cursor destroy
|
|
9361
|
+
* or when setting a new custom handler.
|
|
9362
|
+
* @param cursors A container holding information about the cursor elements.
|
|
9363
|
+
*/
|
|
9364
|
+
onDetach(cursors: Cursors): void;
|
|
9365
|
+
/**
|
|
9366
|
+
* Instructs the handler to place the bar cursor for the given beat bounds instantly .
|
|
9367
|
+
* @param barCursor The bar cursor.
|
|
9368
|
+
* @param beatBounds The bounds of the currently active beat.
|
|
9369
|
+
*/
|
|
9370
|
+
placeBarCursor(barCursor: IContainer, beatBounds: BeatBounds): void;
|
|
9371
|
+
/**
|
|
9372
|
+
* Instructs the handler to place the beat cursor for the given beat bounds instantly.
|
|
9373
|
+
* @param barCursor The beat cursor.
|
|
9374
|
+
* @param beatBounds The bounds of the currently active beat.
|
|
9375
|
+
*/
|
|
9376
|
+
placeBeatCursor(beatCursor: IContainer, beatBounds: BeatBounds, startBeatX: number): void;
|
|
9377
|
+
/**
|
|
9378
|
+
* Instructs the handler to initiate a transition of the beat cursor (e.g. for dynamic animation).
|
|
9379
|
+
* @param beatCursor The beat cursor
|
|
9380
|
+
* @param beatBounds The bounds of the currently active beat.
|
|
9381
|
+
* @param startBeatX The X-position where the transition of the beat cursor should start.
|
|
9382
|
+
* @param nextBeatX The X-position where the transition of the beat cursor should end
|
|
9383
|
+
* (typically the next beat or end of bar depending on the cursor mode and seeks)
|
|
9384
|
+
* @param duration The duration in milliseconds on how long the transition should take.
|
|
9385
|
+
* @param cursorMode The active cursor mode for the cursor placement.
|
|
9386
|
+
*/
|
|
9387
|
+
transitionBeatCursor(beatCursor: IContainer, beatBounds: BeatBounds, startBeatX: number, nextBeatX: number, duration: number, cursorMode: MidiTickLookupFindBeatResultCursorMode): void;
|
|
9388
|
+
}
|
|
9389
|
+
|
|
9286
9390
|
/**
|
|
9287
9391
|
* An emitter for an event without any value passed to the listeners.
|
|
9288
9392
|
* @public
|
|
@@ -9372,6 +9476,18 @@ declare interface IExternalMediaSynthOutput extends IBackingTrackSynthOutput {
|
|
|
9372
9476
|
updatePosition(currentTime: number): void;
|
|
9373
9477
|
}
|
|
9374
9478
|
|
|
9479
|
+
/**
|
|
9480
|
+
* A UI element implementation wrapping HTML elements.
|
|
9481
|
+
* @target web
|
|
9482
|
+
* @public
|
|
9483
|
+
*/
|
|
9484
|
+
declare interface IHtmlElementContainer extends IContainer {
|
|
9485
|
+
/**
|
|
9486
|
+
* The wrapped UI element.
|
|
9487
|
+
*/
|
|
9488
|
+
readonly element: HTMLElement;
|
|
9489
|
+
}
|
|
9490
|
+
|
|
9375
9491
|
/**
|
|
9376
9492
|
* @public
|
|
9377
9493
|
*/
|
|
@@ -11371,6 +11487,11 @@ declare class MidiTickLookup {
|
|
|
11371
11487
|
* This info allows building the correct "next" beat and duration.
|
|
11372
11488
|
*/
|
|
11373
11489
|
multiBarRestInfo: Map<number, number[]> | null;
|
|
11490
|
+
/**
|
|
11491
|
+
* An optional playback range to consider when performing lookups.
|
|
11492
|
+
* This will mainly influence the used {@link MidiTickLookupFindBeatResultCursorMode}
|
|
11493
|
+
*/
|
|
11494
|
+
playbackRange: PlaybackRange | null;
|
|
11374
11495
|
/**
|
|
11375
11496
|
* Finds the currently played beat given a list of tracks and the current time.
|
|
11376
11497
|
* @param trackLookup The tracks indices in which to search the played beat for.
|
|
@@ -11488,9 +11609,14 @@ declare enum MidiTickLookupFindBeatResultCursorMode {
|
|
|
11488
11609
|
*/
|
|
11489
11610
|
ToNextBext = 1,
|
|
11490
11611
|
/**
|
|
11491
|
-
*
|
|
11612
|
+
* @deprecated replaced by {@link ToEndOfBeat}
|
|
11492
11613
|
*/
|
|
11493
|
-
ToEndOfBar = 2
|
|
11614
|
+
ToEndOfBar = 2,
|
|
11615
|
+
/**
|
|
11616
|
+
* The cursor should animate to the end of the **beat** (typically on repeats and jumps)
|
|
11617
|
+
* (this is named end of bar historically)
|
|
11618
|
+
*/
|
|
11619
|
+
ToEndOfBeat = 3
|
|
11494
11620
|
}
|
|
11495
11621
|
|
|
11496
11622
|
/**
|
|
@@ -13283,12 +13409,13 @@ export declare namespace platform {
|
|
|
13283
13409
|
export {
|
|
13284
13410
|
Cursors,
|
|
13285
13411
|
ICanvas,
|
|
13412
|
+
MeasuredText,
|
|
13286
13413
|
TextAlign,
|
|
13287
13414
|
TextBaseline,
|
|
13288
|
-
MeasuredText,
|
|
13289
13415
|
IContainer,
|
|
13290
13416
|
IMouseEventArgs,
|
|
13291
|
-
IUiFacade
|
|
13417
|
+
IUiFacade,
|
|
13418
|
+
IHtmlElementContainer
|
|
13292
13419
|
}
|
|
13293
13420
|
}
|
|
13294
13421
|
|