mirror of https://github.com/ppy/osu
Simplify SliderBall and fix incorrect key up handling
Was not processing timeToAcceptAnyKeyAfter when cursor was outside valid tracking area, but should have been.
This commit is contained in:
parent
acc160042b
commit
7f5780c615
|
@ -125,6 +125,8 @@ protected override bool OnMouseMove(MouseMoveEvent e)
|
|||
return base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
public bool OnReleased(OsuAction action) => false;
|
||||
|
||||
public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null)
|
||||
{
|
||||
// Consider the case of rewinding - children's transforms are handled internally, so propagating down
|
||||
|
@ -148,8 +150,6 @@ private set
|
|||
}
|
||||
}
|
||||
|
||||
private bool canCurrentlyTrack => Time.Current >= slider.StartTime && Time.Current < slider.EndTime && lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value);
|
||||
|
||||
/// <summary>
|
||||
/// If the cursor moves out of the ball's radius we still need to be able to receive positional updates to stop tracking.
|
||||
/// </summary>
|
||||
|
@ -183,26 +183,25 @@ protected override void Update()
|
|||
if (headCircleHitAction == null)
|
||||
timeToAcceptAnyKeyAfter = null;
|
||||
|
||||
if (canCurrentlyTrack)
|
||||
var actions = drawableSlider?.OsuActionInputManager?.PressedActions;
|
||||
|
||||
// if the head circle was hit with a specific key, tracking should only occur while that key is pressed.
|
||||
if (headCircleHitAction != null && timeToAcceptAnyKeyAfter == null)
|
||||
{
|
||||
var pressed = drawableSlider?.OsuActionInputManager?.PressedActions;
|
||||
var otherKey = headCircleHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton;
|
||||
|
||||
// if the head circle was hit with a specific key, tracking should only occur while that key is pressed.
|
||||
if (headCircleHitAction != null && timeToAcceptAnyKeyAfter == null)
|
||||
{
|
||||
var otherKey = headCircleHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton;
|
||||
|
||||
// we can return to accepting all keys if the initial head circle key is the *only* key pressed, or all keys have been released.
|
||||
if (!pressed.Contains(otherKey))
|
||||
timeToAcceptAnyKeyAfter = Time.Current;
|
||||
}
|
||||
|
||||
Tracking = drawableSlider?.OsuActionInputManager?.PressedActions.Any(isValidTrackingAction) ?? false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Tracking = false;
|
||||
// we can return to accepting all keys if the initial head circle key is the *only* key pressed, or all keys have been released.
|
||||
if (actions?.Contains(otherKey) != true)
|
||||
timeToAcceptAnyKeyAfter = Time.Current;
|
||||
}
|
||||
|
||||
Tracking =
|
||||
// in valid time range
|
||||
Time.Current >= slider.StartTime && Time.Current < slider.EndTime &&
|
||||
// in valid position range
|
||||
lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
|
||||
// valid action
|
||||
(actions?.Any(isValidTrackingAction) ?? false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue