Initial implementation of timeline blueprint dragbars

This commit is contained in:
Dean Herbert
2020-02-05 17:16:37 +09:00
parent cd6902a312
commit d04cc0123d
2 changed files with 85 additions and 27 deletions

View File

@ -179,11 +179,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
[Resolved]
private IBeatSnapProvider beatSnapProvider { get; set; }
public (Vector2 position, double time) GetSnappedPosition(Vector2 position, double time)
{
var targetTime = (position.X / Content.DrawWidth) * track.Length;
return (position, beatSnapProvider.SnapTime(targetTime));
}
public double GetTimeFromScreenSpacePosition(Vector2 position)
=> getTimeFromPosition(Content.ToLocalSpace(position));
public (Vector2 position, double time) GetSnappedPosition(Vector2 position, double time) =>
(position, beatSnapProvider.SnapTime(getTimeFromPosition(position)));
private double getTimeFromPosition(Vector2 localPosition) =>
(localPosition.X / Content.DrawWidth) * track.Length;
public float GetBeatSnapDistanceAt(double referenceTime) => throw new NotImplementedException();