1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:12:56 +08:00

prioritize closest snap position

This commit is contained in:
Wleter 2023-02-03 16:05:16 +01:00
parent 23e9bdd554
commit 20e220df56

View File

@ -189,11 +189,14 @@ namespace osu.Game.Rulesets.Osu.Edit
var snapPositions = b.ScreenSpaceSnapPoints;
var filteredSnapPositions = snapPositions.Cast<Vector2?>().FirstOrDefault(p => Vector2.Distance(p.Value, screenSpacePosition) < snapRadius);
if (!snapPositions.Any())
continue;
if (filteredSnapPositions.HasValue)
var closestSnapPosition = snapPositions.MinBy(p => Vector2.Distance(p, screenSpacePosition));
if (Vector2.Distance(closestSnapPosition, screenSpacePosition) < snapRadius)
{
var snap = filteredSnapPositions.Value;
var snap = closestSnapPosition;
// only return distance portion, since time is not really valid
snapResult = new SnapResult(snap, null, playfield);