Add fill to default skin slider ball when tracking

This commit is contained in:
Dean Herbert 2020-02-21 17:38:23 +09:00
parent e18d736e4a
commit 00b4fc1e1f
1 changed files with 14 additions and 2 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -214,9 +215,13 @@ public DefaultFollowCircle()
public class DefaultSliderBall : CompositeDrawable
{
private Box box;
[BackgroundDependencyLoader]
private void load(DrawableHitObject drawableObject, ISkinSource skin)
{
var slider = (DrawableSlider)drawableObject;
RelativeSizeAxes = Axes.Both;
float radius = skin.GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.SliderPathRadius)?.Value ?? OsuHitObject.OBJECT_RADIUS;
@ -231,14 +236,21 @@ private void load(DrawableHitObject drawableObject, ISkinSource skin)
BorderThickness = 10,
BorderColour = Color4.White,
Alpha = 1,
Child = new Box
Child = box = new Box
{
Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
Alpha = 0.4f,
AlwaysPresent = true,
Alpha = 0
}
};
slider.Tracking.BindValueChanged(trackingChanged, true);
}
private void trackingChanged(ValueChangedEvent<bool> tracking) =>
box.FadeTo(tracking.NewValue ? 0.6f : 0.05f, 200, Easing.OutQuint);
}
}
}