// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Edit { /// /// A snap provider which given a reference hit object and proposed distance from it, offers a more correct duration or distance value. /// [Cached] public interface IDistanceSnapProvider : IPositionSnapProvider { /// /// A multiplier which changes the ratio of distance travelled per time unit. /// Importantly, this is provided for manual usage, and not multiplied into any of the methods exposed by this interface. /// /// IBindable DistanceSpacingMultiplier { get; } /// /// Retrieves the distance between two points within a timing point that are one beat length apart. /// /// An object to be used as a reference point for this operation. /// The distance between two points residing in the timing point that are one beat length apart. float GetBeatSnapDistanceAt(HitObject referenceObject); /// /// Converts a duration to a distance without applying any snapping. /// /// An object to be used as a reference point for this operation. /// The duration to convert. /// A value that represents as a distance in the timing point. float DurationToDistance(HitObject referenceObject, double duration); /// /// Converts a distance to a duration without applying any snapping. /// /// An object to be used as a reference point for this operation. /// The distance to convert. /// A value that represents as a duration in the timing point. double DistanceToDuration(HitObject referenceObject, float distance); /// /// Given a distance from the provided hit object, find the valid snapped duration. /// /// An object to be used as a reference point for this operation. /// The distance to convert. /// A value that represents as a duration snapped to the closest beat of the timing point. double FindSnappedDuration(HitObject referenceObject, float distance); /// /// Given a distance from the provided hit object, find the valid snapped distance. /// /// An object to be used as a reference point for this operation. /// The distance to convert. /// /// A value that represents snapped to the closest beat of the timing point. /// The distance will always be less than or equal to the provided . /// float FindSnappedDistance(HitObject referenceObject, float distance); } }