1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +08:00

Fix slider ticks being scaled incorrectly (#5460)

Fix slider ticks being scaled incorrectly
This commit is contained in:
Dean Herbert 2019-07-29 18:48:27 +09:00 committed by GitHub
commit 8487ecf98a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
@ -16,36 +18,49 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public const double ANIM_DURATION = 150;
private const float default_tick_size = 16;
public bool Tracking { get; set; }
public override bool DisplayResult => false;
private readonly SkinnableDrawable scaleContainer;
public DrawableSliderTick(SliderTick sliderTick)
: base(sliderTick)
{
Size = new Vector2(16 * sliderTick.Scale);
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
Origin = Anchor.Centre;
InternalChildren = new Drawable[]
InternalChild = scaleContainer = new SkinnableDrawable("Play/osu/sliderscorepoint", _ => new CircularContainer
{
new SkinnableDrawable("Play/osu/sliderscorepoint", _ => new Container
Masking = true,
Origin = Anchor.Centre,
Size = new Vector2(default_tick_size),
BorderThickness = default_tick_size / 4,
BorderColour = Color4.White,
Child = new Box
{
Masking = true,
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
CornerRadius = Size.X / 2,
BorderThickness = 2,
BorderColour = Color4.White,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = AccentColour.Value,
Alpha = 0.3f,
}
})
Colour = AccentColour.Value,
Alpha = 0.3f,
}
})
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
}
private readonly IBindable<float> scaleBindable = new Bindable<float>();
[BackgroundDependencyLoader]
private void load()
{
scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true);
scaleBindable.BindTo(HitObject.ScaleBindable);
}
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (timeOffset >= 0)