1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 14:27:25 +08:00

Fix wasteful recreating of container

This commit is contained in:
OliBomby 2024-06-06 14:48:17 +02:00
parent 7a8a37dae6
commit 71ce400359

View File

@ -33,7 +33,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private const float circle_size = 38; private const float circle_size = 38;
private Container? repeatsContainer; private Container? repeatsContainer;
private Container? nodeSamplesContainer;
public Action<DragEvent?>? OnDragHandled = null!; public Action<DragEvent?>? OnDragHandled = null!;
@ -246,16 +245,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
} }
// Add node sample pieces // Add node sample pieces
nodeSamplesContainer?.Expire(); sampleComponents.Clear();
sampleComponents.Add(nodeSamplesContainer = new Container
{
RelativeSizeAxes = Axes.Both,
});
for (int i = 0; i < repeats.RepeatCount + 2; i++) for (int i = 0; i < repeats.RepeatCount + 2; i++)
{ {
nodeSamplesContainer.Add(new NodeSamplePointPiece(Item, i) sampleComponents.Add(new NodeSamplePointPiece(Item, i)
{ {
X = (float)i / (repeats.RepeatCount + 1), X = (float)i / (repeats.RepeatCount + 1),
RelativePositionAxes = Axes.X, RelativePositionAxes = Axes.X,