1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:02:55 +08:00

Reset slider input manager state completely on new object application

Kind of scary this wasn't happening already.

Mirrors `SpinnerRotationTracker`.
This commit is contained in:
Bartłomiej Dach 2024-02-29 11:54:42 +01:00
parent d05b31933f
commit 1d1db951f0
No known key found for this signature in database

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Screens.Play;
using osuTK;
@ -56,6 +57,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public SliderInputManager(DrawableSlider slider)
{
this.slider = slider;
this.slider.HitObjectApplied += resetState;
}
/// <summary>
@ -287,5 +289,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
return action == OsuAction.LeftButton || action == OsuAction.RightButton;
}
private void resetState(DrawableHitObject obj)
{
Tracking = false;
trackingHistory.Clear();
trackingHistory.Push((double.NegativeInfinity, false));
timeToAcceptAnyKeyAfter = null;
lastPressedActions.Clear();
screenSpaceMousePosition = null;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
slider.HitObjectApplied -= resetState;
}
}
}