Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make slider tracking match what is on screen #7714

Merged
merged 2 commits into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public void TestTrackingAreaEdge()
performTest(new List<ReplayFrame>
{
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.19f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 100 },
new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.19f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 250 },
new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.199f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
});

Expand All @@ -320,7 +320,7 @@ public void TestTrackingAreaOutsideEdge()
performTest(new List<ReplayFrame>
{
new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.21f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 100 },
new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.21f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 250 },
new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.201f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
});

Expand Down
14 changes: 2 additions & 12 deletions osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class SliderBall : CircularContainer, ISliderProgress, IRequireHighFreque

private readonly Slider slider;
private readonly Drawable followCircle;
private readonly Drawable trackingArea;
private readonly DrawableSlider drawableSlider;

public SliderBall(Slider slider, DrawableSlider drawableSlider = null)
Expand All @@ -39,13 +38,6 @@ public SliderBall(Slider slider, DrawableSlider drawableSlider = null)

Children = new[]
{
// This is separate from the visible followcircle to ensure consistent internal tracking area (needed to match osu-stable)
trackingArea = new CircularContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both
},
followCircle = new FollowCircleContainer
{
Origin = Anchor.Centre,
Expand Down Expand Up @@ -103,9 +95,7 @@ private set

tracking = value;

// Tracking area is bigger than the visible followcircle and scales instantly to match osu-stable
trackingArea.ScaleTo(tracking ? 2.4f : 1f);
followCircle.ScaleTo(tracking ? 2f : 1f, 300, Easing.OutQuint);
followCircle.ScaleTo(tracking ? 2.4f : 1f, 300, Easing.OutQuint);
followCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
}
}
Expand Down Expand Up @@ -159,7 +149,7 @@ protected override void Update()
// in valid time range
Time.Current >= slider.StartTime && Time.Current < slider.EndTime &&
// in valid position range
lastScreenSpaceMousePosition.HasValue && trackingArea.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
lastScreenSpaceMousePosition.HasValue && followCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
// valid action
(actions?.Any(isValidTrackingAction) ?? false);
}
Expand Down