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

Fix slider rotation causing thousands of new drawables to be created

This commit is contained in:
Dean Herbert 2022-09-15 00:51:02 +09:00
parent b324a8caec
commit 87384db872
2 changed files with 7 additions and 9 deletions

View File

@ -66,11 +66,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
cachePoints(slider);
sliderVersion = slider.Path.Version.GetBoundCopy();
sliderVersion.BindValueChanged(_ =>
// schedule ensure that updates are only applied after all operations from a single frame are applied.
// this avoids inadvertently changing the slider path type for bach operations.
sliderVersion.BindValueChanged(_ => Scheduler.AddOnce(() =>
{
cachePoints(slider);
updatePathType();
});
}));
controlPoint.Changed += updateMarkerDisplay;

View File

@ -186,13 +186,8 @@ namespace osu.Game.Rulesets.Osu.Edit
if (h is IHasPath path)
{
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);
foreach (PathControlPoint t in path.Path.ControlPoints)
t.Position = RotatePointAroundOrigin(t.Position, Vector2.Zero, delta);
}
}