1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-19 09:07:18 +08:00

Add inline comment explaining necessity to use AddRange for slider transform operations

This commit is contained in:
Dean Herbert 2022-08-20 11:38:43 +09:00
parent 65f7ecec83
commit 36e202c70e

View File

@ -133,6 +133,8 @@ namespace osu.Game.Rulesets.Osu.Edit
(direction == Direction.Vertical ? -1 : 1) * p.Position.Y
), p.Type)).ToArray();
// Importantly, update as a single operation so automatic adjustment of control points to different
// curve types does not unexpectedly trigger and change the slider's shape.
slider.Path.ControlPoints.Clear();
slider.Path.ControlPoints.AddRange(controlPoints);
}
@ -187,6 +189,8 @@ namespace osu.Game.Rulesets.Osu.Edit
var controlPoints = path.Path.ControlPoints.Select(p =>
new PathControlPoint(RotatePointAroundOrigin(p.Position, Vector2.Zero, delta), p.Type)).ToArray();
// Importantly, update as a single operation so automatic adjustment of control points to different
// curve types does not unexpectedly trigger and change the slider's shape.
path.Path.ControlPoints.Clear();
path.Path.ControlPoints.AddRange(controlPoints);
}