mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 08:03:52 +09:00
Expose and consume boolean covering whether an ongoing smooth seek is running
This commit is contained in:
@ -146,12 +146,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
seekTrackToCurrent();
|
seekTrackToCurrent();
|
||||||
else if (!editorClock.IsRunning)
|
else if (!editorClock.IsRunning)
|
||||||
{
|
{
|
||||||
// The track isn't running. There are two cases we have to be wary of:
|
// The track isn't running. There are three cases we have to be wary of:
|
||||||
// 1) The user flick-drags on this timeline: We want the track to follow us
|
// 1) The user flick-drags on this timeline and we are applying an interpolated seek on the clock, until interrupted by 2 or 3.
|
||||||
// 2) The user changes the track time through some other means (scrolling in the editor or overview timeline): We want to follow the track time
|
// 2) The user changes the track time through some other means (scrolling in the editor or overview timeline; clicking a hitobject etc.). We want the timeline to track the clock's time.
|
||||||
|
// 3) An ongoing seek transform is running from an external seek. We want the timeline to track the clock's time.
|
||||||
|
|
||||||
// The simplest way to cover both cases is by checking whether the scroll position has changed and the audio hasn't been changed externally
|
// The simplest way to cover both cases is by checking whether the scroll position has changed and the audio hasn't been changed externally
|
||||||
if (Current != lastScrollPosition && editorClock.CurrentTime == lastTrackTime)
|
// Checking IsSeeking covers the third case, where the transform may not have been applied yet.
|
||||||
|
if (Current != lastScrollPosition && editorClock.CurrentTime == lastTrackTime && !editorClock.IsSeeking)
|
||||||
seekTrackToCurrent();
|
seekTrackToCurrent();
|
||||||
else
|
else
|
||||||
scrollToTrackTime();
|
scrollToTrackTime();
|
||||||
|
@ -35,6 +35,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
private readonly Bindable<bool> seekingOrStopped = new Bindable<bool>(true);
|
private readonly Bindable<bool> seekingOrStopped = new Bindable<bool>(true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether a seek is currently in progress. True for the duration of a seek performed via <see cref="SeekSmoothlyTo"/>.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSeeking { get; private set; }
|
||||||
|
|
||||||
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
||||||
: this(beatmap.Beatmap.ControlPointInfo, beatmap.Track.Length, beatDivisor)
|
: this(beatmap.Beatmap.ControlPointInfo, beatmap.Track.Length, beatDivisor)
|
||||||
{
|
{
|
||||||
@ -176,7 +181,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
public bool Seek(double position)
|
public bool Seek(double position)
|
||||||
{
|
{
|
||||||
seekingOrStopped.Value = true;
|
seekingOrStopped.Value = IsSeeking = true;
|
||||||
|
|
||||||
ClearTransforms();
|
ClearTransforms();
|
||||||
return underlyingClock.Seek(position);
|
return underlyingClock.Seek(position);
|
||||||
@ -246,6 +251,8 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
if (seekingOrStopped.Value)
|
if (seekingOrStopped.Value)
|
||||||
{
|
{
|
||||||
|
IsSeeking &= Transforms.Any();
|
||||||
|
|
||||||
if (track.Value?.IsRunning != true)
|
if (track.Value?.IsRunning != true)
|
||||||
{
|
{
|
||||||
// seeking in the editor can happen while the track isn't running.
|
// seeking in the editor can happen while the track isn't running.
|
||||||
@ -256,7 +263,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
// we are either running a seek tween or doing an immediate seek.
|
// we are either running a seek tween or doing an immediate seek.
|
||||||
// in the case of an immediate seek the seeking bool will be set to false after one update.
|
// in the case of an immediate seek the seeking bool will be set to false after one update.
|
||||||
// this allows for silencing hit sounds and the likes.
|
// this allows for silencing hit sounds and the likes.
|
||||||
seekingOrStopped.Value = Transforms.Any();
|
seekingOrStopped.Value = IsSeeking;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user