// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osuTK; namespace osu.Game.Rulesets.Edit { public interface IPositionSnapProvider { /// /// Given a position, find a valid time and position snap. /// /// /// This call should be equivalent to running with any additional logic that can be performed without the time immutability restriction. /// /// The screen-space position to be snapped. /// The time and position post-snapping. SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition); /// /// Given a position, find a value position snap, restricting time to its input value. /// /// The screen-space position to be snapped. /// The position post-snapping. Time will always be null. SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition); /// /// Retrieves the distance between two points within a timing point that are one beat length apart. /// /// The time of the timing point. /// The distance between two points residing in the timing point that are one beat length apart. float GetBeatSnapDistanceAt(double referenceTime); /// /// Converts a duration to a distance. /// /// The time of the timing point which resides in. /// The duration to convert. /// A value that represents as a distance in the timing point. float DurationToDistance(double referenceTime, double duration); /// /// Converts a distance to a duration. /// /// The time of the timing point which resides in. /// The distance to convert. /// A value that represents as a duration in the timing point. double DistanceToDuration(double referenceTime, float distance); /// /// Converts a distance to a snapped duration. /// /// The time of the timing point which resides in. /// The distance to convert. /// A value that represents as a duration snapped to the closest beat of the timing point. double GetSnappedDurationFromDistance(double referenceTime, float distance); /// /// Converts an unsnapped distance to a snapped distance. /// The returned distance will always be floored (as to never exceed the provided . /// /// The time of the timing point which resides in. /// The distance to convert. /// A value that represents snapped to the closest beat of the timing point. float GetSnappedDistanceFromDistance(double referenceTime, float distance); } }