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:
parent
b324a8caec
commit
87384db872
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user