mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 09:57:21 +09:00
check every snap position in blueprint
This commit is contained in:
parent
054938be02
commit
23e9bdd554
@ -187,28 +187,18 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
if (b.IsSelected)
|
if (b.IsSelected)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var hitObject = (OsuHitObject)b.Item;
|
var snapPositions = b.ScreenSpaceSnapPoints;
|
||||||
|
|
||||||
Vector2? snap = checkSnap(hitObject.Position);
|
var filteredSnapPositions = snapPositions.Cast<Vector2?>().FirstOrDefault(p => Vector2.Distance(p.Value, screenSpacePosition) < snapRadius);
|
||||||
if (snap == null && hitObject.Position != hitObject.EndPosition)
|
|
||||||
snap = checkSnap(hitObject.EndPosition);
|
|
||||||
|
|
||||||
if (snap != null)
|
if (filteredSnapPositions.HasValue)
|
||||||
{
|
{
|
||||||
|
var snap = filteredSnapPositions.Value;
|
||||||
|
|
||||||
// only return distance portion, since time is not really valid
|
// only return distance portion, since time is not really valid
|
||||||
snapResult = new SnapResult(snap.Value, null, playfield);
|
snapResult = new SnapResult(snap, null, playfield);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2? checkSnap(Vector2 checkPos)
|
|
||||||
{
|
|
||||||
Vector2 checkScreenPos = playfield.GamefieldToScreenSpace(checkPos);
|
|
||||||
|
|
||||||
if (Vector2.Distance(checkScreenPos, screenSpacePosition) < snapRadius)
|
|
||||||
return checkScreenPos;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snapResult = null;
|
snapResult = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user