mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:43:19 +08:00
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 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
return base.OnMouseMove(e);
|
return base.OnMouseMove(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool OnReleased(OsuAction action) => false;
|
||||||
|
|
||||||
public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null)
|
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
|
// Consider the case of rewinding - children's transforms are handled internally, so propagating down
|
||||||
@ -148,8 +150,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool canCurrentlyTrack => Time.Current >= slider.StartTime && Time.Current < slider.EndTime && lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If the cursor moves out of the ball's radius we still need to be able to receive positional updates to stop tracking.
|
/// If the cursor moves out of the ball's radius we still need to be able to receive positional updates to stop tracking.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -183,9 +183,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
if (headCircleHitAction == null)
|
if (headCircleHitAction == null)
|
||||||
timeToAcceptAnyKeyAfter = null;
|
timeToAcceptAnyKeyAfter = null;
|
||||||
|
|
||||||
if (canCurrentlyTrack)
|
var actions = drawableSlider?.OsuActionInputManager?.PressedActions;
|
||||||
{
|
|
||||||
var pressed = drawableSlider?.OsuActionInputManager?.PressedActions;
|
|
||||||
|
|
||||||
// if the head circle was hit with a specific key, tracking should only occur while that key is pressed.
|
// if the head circle was hit with a specific key, tracking should only occur while that key is pressed.
|
||||||
if (headCircleHitAction != null && timeToAcceptAnyKeyAfter == null)
|
if (headCircleHitAction != null && timeToAcceptAnyKeyAfter == null)
|
||||||
@ -193,16 +191,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
var otherKey = headCircleHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton;
|
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.
|
// 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))
|
if (actions?.Contains(otherKey) != true)
|
||||||
timeToAcceptAnyKeyAfter = Time.Current;
|
timeToAcceptAnyKeyAfter = Time.Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tracking = drawableSlider?.OsuActionInputManager?.PressedActions.Any(isValidTrackingAction) ?? false;
|
Tracking =
|
||||||
}
|
// in valid time range
|
||||||
else
|
Time.Current >= slider.StartTime && Time.Current < slider.EndTime &&
|
||||||
{
|
// in valid position range
|
||||||
Tracking = false;
|
lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
|
||||||
}
|
// valid action
|
||||||
|
(actions?.Any(isValidTrackingAction) ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user