mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Fix hitobjects placed at non-beatsnapped times
This commit is contained in:
parent
0e33494074
commit
3441ab457d
@ -24,10 +24,15 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
protected Column Column;
|
protected Column Column;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current mouse position, snapped to the closest column.
|
/// The current beat-snapped mouse position, snapped to the closest column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Vector2 SnappedMousePosition { get; private set; }
|
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>
|
/// <summary>
|
||||||
/// The width of the closest column to the current mouse position.
|
/// The width of the closest column to the current mouse position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -39,6 +44,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IScrollingInfo scrollingInfo { get; set; }
|
private IScrollingInfo scrollingInfo { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IDistanceSnapProvider snapProvider { get; set; }
|
||||||
|
|
||||||
protected ManiaPlacementBlueprint(T hitObject)
|
protected ManiaPlacementBlueprint(T hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
@ -54,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
return base.OnMouseDown(e);
|
return base.OnMouseDown(e);
|
||||||
|
|
||||||
HitObject.Column = Column.Index;
|
HitObject.Column = Column.Index;
|
||||||
BeginPlacement(TimeAt(e.ScreenSpaceMousePosition), true);
|
BeginPlacement(SnappedTime, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +78,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
// Snap to the column
|
// Snap to the column
|
||||||
var parentPos = Parent.ToLocalSpace(Column.ToScreenSpace(new Vector2(Column.DrawWidth / 2, 0)));
|
var parentPos = Parent.ToLocalSpace(Column.ToScreenSpace(new Vector2(Column.DrawWidth / 2, 0)));
|
||||||
SnappedMousePosition = new Vector2(parentPos.X, Parent.ToLocalSpace(screenSpacePosition).Y);
|
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)
|
protected double TimeAt(Vector2 screenSpacePosition)
|
||||||
|
Loading…
Reference in New Issue
Block a user