Skip to content

Commit

Permalink
Merge pull request #30063 from bdach/snap-sliders-on-path-type-change
Browse files Browse the repository at this point in the history
Ensure sliders are snapped when changing path types
  • Loading branch information
peppy authored Oct 1, 2024
2 parents 7d756d0 + 493dcc7 commit 0bff7e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0bff7e8

Please sign in to comment.