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

Fix overlay positions/sizes due to sliders now being fixed

This commit is contained in:
smoogipoo 2018-03-01 14:34:31 +09:00
parent d5d4bcb558
commit e62fab6cc2
2 changed files with 20 additions and 4 deletions

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit.Layers.Selection;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using OpenTK;
@ -15,18 +14,22 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
public class SliderCircleOverlay : HitObjectOverlay
{
public SliderCircleOverlay(DrawableHitCircle sliderHead, DrawableSlider slider)
: this(sliderHead, ((Slider)slider.HitObject).StackedPositionAt(0), slider)
: this(sliderHead, sliderHead.Position, slider)
{
}
public SliderCircleOverlay(DrawableSliderTail sliderTail, DrawableSlider slider)
: this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1) + slider.HitObject.StackOffset, slider)
: this(sliderTail, sliderTail.Position, slider)
{
}
private readonly DrawableOsuHitObject hitObject;
private SliderCircleOverlay(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider)
: base(hitObject)
{
this.hitObject = hitObject;
Origin = Anchor.Centre;
Position = position;
@ -41,5 +44,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
{
Colour = colours.Yellow;
}
protected override void Update()
{
base.Update();
RelativeAnchorPosition = hitObject.RelativeAnchorPosition;
}
}
}

View File

@ -15,10 +15,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
public class SliderOverlay : HitObjectOverlay
{
private readonly SliderBody body;
private readonly DrawableSlider slider;
public SliderOverlay(DrawableSlider slider)
: base(slider)
{
this.slider = slider;
var obj = (Slider)slider.HitObject;
InternalChildren = new Drawable[]
@ -26,7 +29,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
body = new SliderBody(obj)
{
AccentColour = Color4.Transparent,
Position = obj.StackedPosition,
PathWidth = obj.Scale * 64
},
new SliderCircleOverlay(slider.HeadCircle, slider),
@ -44,6 +46,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
{
base.Update();
Position = slider.Position;
Size = slider.Size;
OriginPosition = slider.OriginPosition;
// Need to cause one update
body.UpdateProgress(0);
}