mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
prioritize closest snap position
This commit is contained in:
parent
23e9bdd554
commit
20e220df56
@ -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;
|
||||
|
||||
var closestSnapPosition = snapPositions.MinBy(p => Vector2.Distance(p, screenSpacePosition));
|
||||
|
||||
if (filteredSnapPositions.HasValue)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user