Undo beat snapping related changes

This commit is contained in:
Dean Herbert 2020-05-21 12:11:39 +09:00
parent ea45637b02
commit 83a5913b8d
2 changed files with 7 additions and 26 deletions

View File

@ -24,15 +24,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
protected Column Column;
/// <summary>
/// The current beat-snapped mouse position, snapped to the closest column.
/// The current mouse position, snapped to the closest column.
/// </summary>
protected Vector2 SnappedMousePosition { get; private set; }
/// <summary>
/// The gameplay time at the current beat-snapped mouse position (<see cref="SnappedMousePosition"/>).
/// </summary>
protected double SnappedTime { get; private set; }
/// <summary>
/// The width of the closest column to the current mouse position.
/// </summary>
@ -44,9 +39,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
[Resolved]
private IScrollingInfo scrollingInfo { get; set; }
[Resolved(CanBeNull = true)]
private IDistanceSnapProvider snapProvider { get; set; }
protected ManiaPlacementBlueprint(T hitObject)
: base(hitObject)
{
@ -62,7 +54,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
return base.OnMouseDown(e);
HitObject.Column = Column.Index;
BeginPlacement(SnappedTime, true);
BeginPlacement(TimeAt(e.ScreenSpaceMousePosition), true);
return true;
}
@ -78,10 +70,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
// Snap to the column
var parentPos = Parent.ToLocalSpace(Column.ToScreenSpace(new Vector2(Column.DrawWidth / 2, 0)));
SnappedMousePosition = new Vector2(parentPos.X, Parent.ToLocalSpace(screenSpacePosition).Y);
SnappedTime = TimeAt(screenSpacePosition);
if (snapProvider != null)
(SnappedMousePosition, SnappedTime) = snapProvider.GetSnappedPosition(SnappedMousePosition, SnappedTime);
}
protected double TimeAt(Vector2 screenSpacePosition)

View File

@ -82,18 +82,9 @@ namespace osu.Game.Rulesets.Mania.Edit
public override (Vector2 position, double time) GetSnappedPosition(Vector2 position, double time)
{
var beatSnapped = beatSnapGrid.GetSnappedPosition(position);
var hoc = Playfield.GetColumn(0).HitObjectContainer;
if (beatSnapped != null)
return beatSnapped.Value;
return base.GetSnappedPosition(position, getTimeFromPosition(ToScreenSpace(position)));
}
private double getTimeFromPosition(Vector2 screenSpacePosition)
{
var hoc = Playfield.Stages[0].HitObjectContainer;
float targetPosition = hoc.ToLocalSpace(screenSpacePosition).Y;
float targetPosition = hoc.ToLocalSpace(ToScreenSpace(position)).Y;
if (drawableRuleset.ScrollingInfo.Direction.Value == ScrollingDirection.Down)
{
@ -103,10 +94,12 @@ namespace osu.Game.Rulesets.Mania.Edit
targetPosition = hoc.DrawHeight - targetPosition;
}
return drawableRuleset.ScrollingInfo.Algorithm.TimeAt(targetPosition,
double targetTime = drawableRuleset.ScrollingInfo.Algorithm.TimeAt(targetPosition,
EditorClock.CurrentTime,
drawableRuleset.ScrollingInfo.TimeRange.Value,
hoc.DrawHeight);
return base.GetSnappedPosition(position, targetTime);
}
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)