mirror of https://github.com/ppy/osu
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:
parent
d05b31933f
commit
1d1db951f0
|
@ -10,6 +10,7 @@
|
|||
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 @@ public partial class SliderInputManager : Component, IRequireHighFrequencyMouseP
|
|||
public SliderInputManager(DrawableSlider slider)
|
||||
{
|
||||
this.slider = slider;
|
||||
this.slider.HitObjectApplied += resetState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -287,5 +289,22 @@ private bool isValidTrackingAction(OsuAction action)
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue