1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 21:02:54 +08:00

Fix CurrentTimeAccurate being inaccurate if seeking smoothly in the same frame and a transform is already active

This commit is contained in:
OliBomby 2024-07-08 13:30:11 +02:00
parent c0a1696538
commit 2822ba2377
2 changed files with 12 additions and 1 deletions

View File

@ -102,6 +102,17 @@ namespace osu.Game.Tests.Visual.Editing
AddUntilStep("time is clamped to track length", () => EditorClock.CurrentTime, () => Is.EqualTo(EditorClock.TrackLength));
}
[Test]
public void TestCurrentTimeDoubleTransform()
{
AddAssert("seek smoothly twice and current time is accurate", () =>
{
EditorClock.SeekSmoothlyTo(1000);
EditorClock.SeekSmoothlyTo(2000);
return 2000 == EditorClock.CurrentTimeAccurate;
});
}
protected override void Dispose(bool isDisposing)
{
Beatmap.Disabled = false;

View File

@ -154,7 +154,7 @@ namespace osu.Game.Screens.Edit
/// The current time of this clock, include any active transform seeks performed via <see cref="SeekSmoothlyTo"/>.
/// </summary>
public double CurrentTimeAccurate =>
Transforms.OfType<TransformSeek>().FirstOrDefault()?.EndValue ?? CurrentTime;
Transforms.OfType<TransformSeek>().LastOrDefault()?.EndValue ?? CurrentTime;
public double CurrentTime => underlyingClock.CurrentTime;