Merge pull request #15301 from jaswon/reverse-slider-symmetric

Fix slider shape not always being maintained when reversing
This commit is contained in:
Dean Herbert 2021-10-26 16:17:29 +09:00 committed by GitHub
commit 4cef86dd12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Objects
public static void Reverse(this SliderPath sliderPath, out Vector2 positionalOffset) public static void Reverse(this SliderPath sliderPath, out Vector2 positionalOffset)
{ {
var points = sliderPath.ControlPoints.ToArray(); var points = sliderPath.ControlPoints.ToArray();
positionalOffset = points.Last().Position; positionalOffset = sliderPath.PositionAt(1);
sliderPath.ControlPoints.Clear(); sliderPath.ControlPoints.Clear();
@ -32,7 +32,10 @@ namespace osu.Game.Rulesets.Objects
// propagate types forwards to last null type // propagate types forwards to last null type
if (i == points.Length - 1) if (i == points.Length - 1)
{
p.Type = lastType; p.Type = lastType;
p.Position = Vector2.Zero;
}
else if (p.Type != null) else if (p.Type != null)
(p.Type, lastType) = (lastType, p.Type); (p.Type, lastType) = (lastType, p.Type);