1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 17:27:24 +08:00

Merge pull request #20945 from peppy/fix-misplaced-slider-head

Fix slider heads getting misplaced after flipping in editor
This commit is contained in:
Dan Balasescu 2022-10-27 12:51:27 +09:00 committed by GitHub
commit 2d829c3beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 17 deletions

View File

@ -377,7 +377,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private void addJudgementAssert(OsuHitObject hitObject, HitResult result)
{
AddAssert($"({hitObject.GetType().ReadableName()} @ {hitObject.StartTime}) judgement is {result}",
() => judgementResults.Single(r => r.HitObject == hitObject).Type == result);
() => judgementResults.Single(r => r.HitObject == hitObject).Type, () => Is.EqualTo(result));
}
private void addJudgementAssert(string name, Func<OsuHitObject> hitObject, HitResult result)

View File

@ -102,8 +102,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Size = HitArea.DrawSize;
PositionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
StackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
PositionBindable.BindValueChanged(_ => UpdatePosition());
StackHeightBindable.BindValueChanged(_ => UpdatePosition());
ScaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue));
}
@ -134,6 +134,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
protected virtual void UpdatePosition()
{
Position = HitObject.StackedPosition;
}
public override void Shake() => shakeContainer.Shake();
protected override void CheckForResult(bool userTriggered, double timeOffset)

View File

@ -6,7 +6,6 @@
using System;
using System.Diagnostics;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
@ -43,13 +42,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
}
[BackgroundDependencyLoader]
private void load()
{
PositionBindable.BindValueChanged(_ => updatePosition());
pathVersion.BindValueChanged(_ => updatePosition());
}
protected override void OnFree()
{
base.OnFree();
@ -57,6 +49,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
pathVersion.UnbindFrom(DrawableSlider.PathVersion);
}
protected override void UpdatePosition()
{
// Slider head is always drawn at (0,0).
}
protected override void OnApply()
{
base.OnApply();
@ -100,11 +97,5 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
base.Shake();
DrawableSlider.Shake();
}
private void updatePosition()
{
if (Slider != null)
Position = HitObject.Position - Slider.Position;
}
}
}