Merge pull request #13984 from ekrctb/catch-editor-reverse

Implement "reverse pattern" in catch editor
This commit is contained in:
Dean Herbert
2021-07-23 01:12:13 +09:00
committed by GitHub
3 changed files with 74 additions and 30 deletions

View File

@ -76,32 +76,8 @@ namespace osu.Game.Rulesets.Osu.Edit
if (h is Slider slider)
{
var points = slider.Path.ControlPoints.ToArray();
Vector2 endPos = points.Last().Position.Value;
slider.Path.ControlPoints.Clear();
slider.Position += endPos;
PathType? lastType = null;
for (var i = 0; i < points.Length; i++)
{
var p = points[i];
p.Position.Value -= endPos;
// propagate types forwards to last null type
if (i == points.Length - 1)
p.Type.Value = lastType;
else if (p.Type.Value != null)
{
var newType = p.Type.Value;
p.Type.Value = lastType;
lastType = newType;
}
slider.Path.ControlPoints.Insert(0, p);
}
slider.Path.Reverse(out Vector2 offset);
slider.Position += offset;
}
}