mirror of
https://github.com/ppy/osu
synced 2025-01-31 10:22:02 +00:00
Fix timeline sizes being updated potentially before the track has a length
This commit is contained in:
parent
7ad21d9a6d
commit
d5ed218488
@ -25,11 +25,31 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
|
||||
Beatmap.ValueChanged += b =>
|
||||
{
|
||||
timeline.RelativeChildSize = new Vector2((float)Math.Max(1, b.Track.Length), 1);
|
||||
updateRelativeChildSize();
|
||||
LoadBeatmap(b);
|
||||
};
|
||||
}
|
||||
|
||||
private void updateRelativeChildSize()
|
||||
{
|
||||
if (!Beatmap.Value.TrackLoaded)
|
||||
{
|
||||
timeline.RelativeChildSize = Vector2.One;
|
||||
return;
|
||||
}
|
||||
|
||||
var track = Beatmap.Value.Track;
|
||||
|
||||
if (!track.IsLoaded)
|
||||
{
|
||||
// the track may not be loaded completely (only has a length once it is).
|
||||
Schedule(updateRelativeChildSize);
|
||||
return;
|
||||
}
|
||||
|
||||
timeline.RelativeChildSize = new Vector2((float)Math.Max(1, track.Length), 1);
|
||||
}
|
||||
|
||||
protected void Add(Drawable visualisation) => timeline.Add(visualisation);
|
||||
|
||||
protected virtual void LoadBeatmap(WorkingBeatmap beatmap)
|
||||
|
Loading…
Reference in New Issue
Block a user