Add xmldoc and remove unnecessary parameter

This commit is contained in:
Dean Herbert 2020-05-21 15:16:30 +09:00
parent ce8b6b7383
commit a756e6d212
3 changed files with 10 additions and 4 deletions

View File

@ -41,8 +41,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
if (Column != null)
{
headPiece.Y = Parent.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.StartTime, Column)).Y;
tailPiece.Y = Parent.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.EndTime, Column)).Y;
headPiece.Y = Parent.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.StartTime)).Y;
tailPiece.Y = Parent.ToLocalSpace(Column.ScreenSpacePositionAtTime(HitObject.EndTime)).Y;
}
var topPosition = new Vector2(headPiece.DrawPosition.X, Math.Min(headPiece.DrawPosition.Y, tailPiece.DrawPosition.Y));

View File

@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Mania.Edit
targetTime = BeatSnapProvider.SnapTime(targetTime);
// convert back to screen space
screenSpacePosition = column.ScreenSpacePositionAtTime(targetTime, column);
screenSpacePosition = column.ScreenSpacePositionAtTime(targetTime);
return new ManiaSnapResult(screenSpacePosition, targetTime, column);
}

View File

@ -142,7 +142,10 @@ namespace osu.Game.Rulesets.Mania.UI
// This probably shouldn't exist as is, but the columns in the stage are separated by a 1px border
=> DrawRectangle.Inflate(new Vector2(Stage.COLUMN_SPACING / 2, 0)).Contains(ToLocalSpace(screenSpacePos));
public Vector2 ScreenSpacePositionAtTime(double time, Column column = null)
/// <summary>
/// Given a time, return the screen space position within this column.
/// </summary>
public Vector2 ScreenSpacePositionAtTime(double time)
{
var pos = ScrollingInfo.Algorithm.PositionAt(time, Time.Current, ScrollingInfo.TimeRange.Value, HitObjectContainer.DrawHeight);
@ -166,6 +169,9 @@ namespace osu.Game.Rulesets.Mania.UI
return HitObjectContainer.ToScreenSpace(new Vector2(HitObjectContainer.DrawWidth / 2, pos));
}
/// <summary>
/// Given a position in screen space, return the time within this column.
/// </summary>
public double TimeAtScreenSpacePosition(Vector2 screenSpacePosition)
{
// convert to local space of column so we can snap and fetch correct location.