1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +08:00

Avoid unnecessarily refreshing SliderBodyPiece's path

This commit is contained in:
Dean Herbert 2022-10-27 16:02:04 +09:00
parent 7916b99153
commit 0c7672e124

View File

@ -40,16 +40,23 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
body.BorderColour = colours.Yellow;
}
private int? lastVersion;
public override void UpdateFrom(Slider hitObject)
{
base.UpdateFrom(hitObject);
body.PathRadius = hitObject.Scale * OsuHitObject.OBJECT_RADIUS;
var vertices = new List<Vector2>();
hitObject.Path.GetPathToProgress(vertices, 0, 1);
if (lastVersion != hitObject.Path.Version.Value)
{
lastVersion = hitObject.Path.Version.Value;
body.SetVertices(vertices);
var vertices = new List<Vector2>();
hitObject.Path.GetPathToProgress(vertices, 0, 1);
body.SetVertices(vertices);
}
Size = body.Size;
OriginPosition = body.PathOffset;