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:
commit
0bff7e8697
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user