1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 21:02:55 +08:00

Merge pull request #30063 from bdach/snap-sliders-on-path-type-change

Ensure sliders are snapped when changing path types
This commit is contained in:
Dean Herbert 2024-10-01 16:03:12 +09:00 committed by GitHub
commit 0bff7e8697
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -353,6 +353,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
changeHandler?.BeginChange();
double originalDistance = hitObject.Path.Distance;
foreach (var p in Pieces.Where(p => p.IsSelected.Value))
{
var pointsInSegment = hitObject.Path.PointsInSegment(p.ControlPoint);
@ -375,6 +377,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
EnsureValidPathTypes();
if (hitObject.Path.Distance < originalDistance)
hitObject.SnapTo(distanceSnapProvider);
else
hitObject.Path.ExpectedDistance.Value = originalDistance;
changeHandler?.EndChange();
}

View File

@ -112,6 +112,7 @@ namespace osu.Game.Tests.Editing
{
SliderVelocityMultiplier = slider_velocity
};
AddStep("add to beatmap", () => composer.EditorBeatmap.Add(referenceObject));
assertSnapDistance(base_distance * slider_velocity, referenceObject, true);
assertSnappedDistance(base_distance * slider_velocity + 10, base_distance * slider_velocity, referenceObject);