Implement slider path distance snapping

This commit is contained in:
smoogipoo
2019-10-24 18:09:20 +09:00
parent ef4dd3e028
commit f45f17339c
3 changed files with 20 additions and 2 deletions

View File

@ -128,6 +128,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <returns>The time at the snapped position.</returns>
public double GetSnapTime(Vector2 position) => startTime + (position - CentrePosition).Length / Velocity;
/// <summary>
/// Snaps a distance by the snap distance of this grid.
/// </summary>
/// <param name="distance">The distance to snap.</param>
/// <returns>The snapped distance.</returns>
public float GetSnapDistance(float distance) => (int)(distance / DistanceSpacing) * DistanceSpacing;
/// <summary>
/// Retrieves the applicable colour for a beat index.
/// </summary>