@coderline/alphatab 1.8.0-alpha.1636 → 1.8.0-alpha.1639

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.
@@ -1745,8 +1745,8 @@ export declare class AlphaTabApiBase<TSettings> {
1745
1745
  private _onActiveBeatsChanged;
1746
1746
  private _isBeatMouseDown;
1747
1747
  private _isNoteMouseDown;
1748
- private _selectionStart;
1749
- private _selectionEnd;
1748
+ private _selectionStart?;
1749
+ private _selectionEnd?;
1750
1750
  /**
1751
1751
  * This event is fired whenever a the user presses the mouse button on a beat.
1752
1752
  * @eventProperty
@@ -1990,6 +1990,163 @@ export declare class AlphaTabApiBase<TSettings> {
1990
1990
  private _onNoteMouseUp;
1991
1991
  private _updateSelectionCursor;
1992
1992
  private _setupClickHandling;
1993
+ /**
1994
+ * Places the highlight markers at the specified start and end-beat range.
1995
+ * @param startBeat The start beat where the selection should start
1996
+ * @param endBeat The end beat where the selection should end.
1997
+ *
1998
+ * @remarks
1999
+ * Unlike actually setting {@link playbackRange} this method only places the selection markers without actually
2000
+ * changing the playback range. This method can be used when building custom selection systems (e.g. having draggable handles).
2001
+ *
2002
+ * @category Methods - Player
2003
+ * @since 1.8.0
2004
+ *
2005
+ * @example
2006
+ * JavaScript
2007
+ * ```js
2008
+ * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
2009
+ * const startBeat = api.score.tracks[0].staves[0].bars[0].voices[0].beats[0];
2010
+ * const endBeat = api.score.tracks[0].staves[0].bars[3].voices[0].beats[0];
2011
+ * api.highlightPlaybackRange(startBeat, endBeat);
2012
+ * ```
2013
+ *
2014
+ * @example
2015
+ * C#
2016
+ * ```cs
2017
+ * var api = new AlphaTabApi<MyControl>(...);
2018
+ * api.ChangeTrackVolume(new Track[] { api.Score.Tracks[0], api.Score.Tracks[1] }, 1.5);
2019
+ * api.ChangeTrackVolume(new Track[] { api.Score.Tracks[2] }, 0.5);
2020
+ * var startBeat = api.Score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0];
2021
+ * var endBeat = api.Score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[0];
2022
+ * api.HighlightPlaybackRange(startBeat, endBeat);
2023
+ * ```
2024
+ *
2025
+ * @example
2026
+ * Android
2027
+ * ```kotlin
2028
+ * val api = AlphaTabApi<MyControl>(...)
2029
+ * val startBeat = api.score.tracks[0].staves[0].bars[0].voices[0].beats[0]
2030
+ * val endBeat = api.score.tracks[0].staves[0].bars[3].voices[0].beats[0]
2031
+ * api.highlightPlaybackRange(startBeat, endBeat)
2032
+ * ```
2033
+ */
2034
+ highlightPlaybackRange(startBeat: Beat, endBeat: Beat): void;
2035
+ /**
2036
+ * Applies the playback range from the currently highlighted range.
2037
+ *
2038
+ * @remarks
2039
+ * This method can be used when building custom selection systems (e.g. having draggable handles).
2040
+ *
2041
+ * @category Methods - Player
2042
+ * @since 1.8.0
2043
+ *
2044
+ * @example
2045
+ * JavaScript
2046
+ * ```js
2047
+ * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
2048
+ * const startBeat = api.score.tracks[0].staves[0].bars[0].voices[0].beats[0];
2049
+ * const endBeat = api.score.tracks[0].staves[0].bars[3].voices[0].beats[0];
2050
+ * api.highlightPlaybackRange(startBeat, endBeat);
2051
+ * api.applyPlaybackRangeFromHighlight();
2052
+ * ```
2053
+ *
2054
+ * @example
2055
+ * C#
2056
+ * ```cs
2057
+ * var api = new AlphaTabApi<MyControl>(...);
2058
+ * api.ChangeTrackVolume(new Track[] { api.Score.Tracks[0], api.Score.Tracks[1] }, 1.5);
2059
+ * api.ChangeTrackVolume(new Track[] { api.Score.Tracks[2] }, 0.5);
2060
+ * var startBeat = api.Score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0];
2061
+ * var endBeat = api.Score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[0];
2062
+ * api.HighlightPlaybackRange(startBeat, endBeat);
2063
+ * api.ApplyPlaybackRangeFromHighlight();
2064
+ * ```
2065
+ *
2066
+ * @example
2067
+ * Android
2068
+ * ```kotlin
2069
+ * val api = AlphaTabApi<MyControl>(...)
2070
+ * val startBeat = api.score.tracks[0].staves[0].bars[0].voices[0].beats[0]
2071
+ * val endBeat = api.score.tracks[0].staves[0].bars[3].voices[0].beats[0]
2072
+ * api.highlightPlaybackRange(startBeat, endBeat)
2073
+ * api.applyPlaybackRangeFromHighlight()
2074
+ * ```
2075
+ */
2076
+ applyPlaybackRangeFromHighlight(): void;
2077
+ /**
2078
+ * Clears the highlight markers marking the currently selected playback range.
2079
+ *
2080
+ * @remarks
2081
+ * Unlike actually setting {@link playbackRange} this method only clears the selection markers without actually
2082
+ * changing the playback range. This method can be used when building custom selection systems (e.g. having draggable handles).
2083
+ *
2084
+ * @category Methods - Player
2085
+ * @since 1.8.0
2086
+ *
2087
+ * @example
2088
+ * JavaScript
2089
+ * ```js
2090
+ * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
2091
+ * api.clearPlaybackRangeHighlight();
2092
+ * ```
2093
+ *
2094
+ * @example
2095
+ * C#
2096
+ * ```cs
2097
+ * var api = new AlphaTabApi<MyControl>(...);
2098
+ * api.clearPlaybackRangeHighlight();
2099
+ * ```
2100
+ *
2101
+ * @example
2102
+ * Android
2103
+ * ```kotlin
2104
+ * val api = AlphaTabApi<MyControl>(...)
2105
+ * api.clearPlaybackRangeHighlight()
2106
+ * ```
2107
+ */
2108
+ clearPlaybackRangeHighlight(): void;
2109
+ /**
2110
+ * This event is fired the shown highlights for the selected playback range changes.
2111
+ *
2112
+ * @remarks
2113
+ * This event is fired already during selection and not only when the selection is completed.
2114
+ * This event can be used to place additional custom selection markers (like drag handles).
2115
+ *
2116
+ * @eventProperty
2117
+ * @category Events - Player
2118
+ * @since 1.8.0
2119
+ *
2120
+ * @example
2121
+ * JavaScript
2122
+ * ```js
2123
+ * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
2124
+ * api.playbackRangeHighlightChanged.on(e => {
2125
+ * updateSelectionHandles(e);
2126
+ * });
2127
+ * ```
2128
+ *
2129
+ * @example
2130
+ * C#
2131
+ * ```cs
2132
+ * var api = new AlphaTabApi<MyControl>(...);
2133
+ * api.PlaybackRangeHighlightChanged.On(e =>
2134
+ * {
2135
+ * UpdateSelectionHandles(e);
2136
+ * });
2137
+ * ```
2138
+ *
2139
+ * @example
2140
+ * Android
2141
+ * ```kotlin
2142
+ * val api = AlphaTabApi<MyControl>(...)
2143
+ * api.playbackRangeHighlightChanged.on { e ->
2144
+ * updateSelectionHandles(e)
2145
+ * }
2146
+ * ```
2147
+ *
2148
+ */
2149
+ readonly playbackRangeHighlightChanged: IEventEmitterOfT<PlaybackHighlightChangeEventArgs>;
1993
2150
  private _cursorSelectRange;
1994
2151
  /**
1995
2152
  * This event is fired whenever a new song is loaded.
@@ -5230,6 +5387,7 @@ declare class Bounds {
5230
5387
  */
5231
5388
  h: number;
5232
5389
  scaleWith(scale: number): void;
5390
+ constructor(x?: number, y?: number, w?: number, h?: number);
5233
5391
  }
5234
5392
 
5235
5393
  /**
@@ -12803,6 +12961,35 @@ export declare namespace platform {
12803
12961
  }
12804
12962
  }
12805
12963
 
12964
+ /**
12965
+ * Holds information about the highlights shown for the playback range.
12966
+ * @public
12967
+ * @record
12968
+ */
12969
+ export declare interface PlaybackHighlightChangeEventArgs {
12970
+ /**
12971
+ * The beat where the selection starts. undefined if there is no selection.
12972
+ */
12973
+ startBeat?: Beat;
12974
+ /**
12975
+ * The bounds of the start beat to determine its location and size.
12976
+ */
12977
+ startBeatBounds?: BeatBounds;
12978
+ /**
12979
+ * The beat where the selection ends. undefined if there is no selection.
12980
+ */
12981
+ endBeat?: Beat;
12982
+ /**
12983
+ * The bounds of the end beat to determine its location and size.
12984
+ */
12985
+ endBeatBounds?: BeatBounds;
12986
+ /**
12987
+ * A list of the individual rectangular areas where highlight blocks are placed.
12988
+ * If a selection spans multiple lines this array will hold all items.
12989
+ */
12990
+ highlightBlocks?: Bounds[];
12991
+ }
12992
+
12806
12993
  /**
12807
12994
  * This public class stores the midi specific information of a track needed
12808
12995
  * for playback.