mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 02:32:59 +08:00
Use alternative workaround
This commit is contained in:
parent
cd1f6b46c4
commit
99cddb6317
@ -141,17 +141,29 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
||||
|
||||
track.BindTo(editorClock.Track);
|
||||
// schedule added as without it, `beatmap.Value.Track.Length` can be 0 immediately after a track switch.
|
||||
track.BindValueChanged(_ => Schedule(() =>
|
||||
track.BindValueChanged(_ =>
|
||||
{
|
||||
waveform.Waveform = beatmap.Value.Waveform;
|
||||
waveform.RelativePositionAxes = Axes.X;
|
||||
waveform.X = -(float)(Editor.WAVEFORM_VISUAL_OFFSET / beatmap.Value.Track.Length);
|
||||
}), true);
|
||||
Scheduler.AddOnce(applyVisualOffset, beatmap);
|
||||
}, true);
|
||||
|
||||
Zoom = (float)(defaultTimelineZoom * editorBeatmap.BeatmapInfo.TimelineZoom);
|
||||
}
|
||||
|
||||
private void applyVisualOffset(IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
waveform.RelativePositionAxes = Axes.X;
|
||||
|
||||
if (beatmap.Value.Track.Length > 0)
|
||||
waveform.X = -(float)(Editor.WAVEFORM_VISUAL_OFFSET / beatmap.Value.Track.Length);
|
||||
else
|
||||
{
|
||||
// sometimes this can be the case immediately after a track switch.
|
||||
// reschedule with the hope that the track length eventually populates.
|
||||
Scheduler.AddOnce(applyVisualOffset, beatmap);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
Loading…
Reference in New Issue
Block a user