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 @@ private void updatePathTypeOfSelectedPieces(PathType? type)
{
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 @@ private void updatePathTypeOfSelectedPieces(PathType? type)
EnsureValidPathTypes();
if (hitObject.Path.Distance < originalDistance)
hitObject.SnapTo(distanceSnapProvider);
else
hitObject.Path.ExpectedDistance.Value = originalDistance;
changeHandler?.EndChange();
}

View File

@ -112,6 +112,7 @@ public void TestConversionsWithSliderVelocity()
{
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);