// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osuTK; namespace osu.Game.Rulesets.Edit { public interface IPositionSnapProvider { /// /// The spacing multiplier applied to beat snap distances. /// /// IBindable DistanceSpacingMultiplier { get; } /// /// 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. /// /// 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. /// /// 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. /// /// 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); /// /// Converts a distance to a 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 GetSnappedDurationFromDistance(HitObject referenceObject, float distance); /// /// Converts an unsnapped distance to a snapped distance. /// The returned distance will always be floored (as to never exceed the provided . /// /// 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. float GetSnappedDistanceFromDistance(HitObject referenceObject, float distance); } }