mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 12:42:54 +08:00
Switch timeline to use track directly from beatmap again
This commit is contained in:
parent
526f06be4c
commit
0b0ff62647
@ -30,6 +30,28 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The timeline's scroll position in the last frame.
|
||||
/// </summary>
|
||||
private float lastScrollPosition;
|
||||
|
||||
/// <summary>
|
||||
/// The track time in the last frame.
|
||||
/// </summary>
|
||||
private double lastTrackTime;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is currently dragging the timeline.
|
||||
/// </summary>
|
||||
private bool handlingDragInput;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the track was playing before a user drag event.
|
||||
/// </summary>
|
||||
private bool trackWasPlaying;
|
||||
|
||||
private ITrack track;
|
||||
|
||||
public Timeline()
|
||||
{
|
||||
ZoomDuration = 200;
|
||||
@ -61,9 +83,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
Beatmap.BindValueChanged(b =>
|
||||
{
|
||||
waveform.Waveform = b.NewValue.Waveform;
|
||||
track = musicController.CurrentTrack;
|
||||
track = b.NewValue.Track;
|
||||
|
||||
if (track.Length > 0)
|
||||
// todo: i don't think this is safe, the track may not be loaded yet.
|
||||
if (b.NewValue.Track.Length > 0)
|
||||
{
|
||||
MaxZoom = getZoomLevelForVisibleMilliseconds(500);
|
||||
MinZoom = getZoomLevelForVisibleMilliseconds(10000);
|
||||
@ -74,28 +97,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
private float getZoomLevelForVisibleMilliseconds(double milliseconds) => (float)(track.Length / milliseconds);
|
||||
|
||||
/// <summary>
|
||||
/// The timeline's scroll position in the last frame.
|
||||
/// </summary>
|
||||
private float lastScrollPosition;
|
||||
|
||||
/// <summary>
|
||||
/// The track time in the last frame.
|
||||
/// </summary>
|
||||
private double lastTrackTime;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user is currently dragging the timeline.
|
||||
/// </summary>
|
||||
private bool handlingDragInput;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the track was playing before a user drag event.
|
||||
/// </summary>
|
||||
private bool trackWasPlaying;
|
||||
|
||||
private ITrack track;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
Loading…
Reference in New Issue
Block a user