diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs
index c582eb1c75..0fdefe6dc9 100644
--- a/osu.Game.Rulesets.Mania/UI/Column.cs
+++ b/osu.Game.Rulesets.Mania/UI/Column.cs
@@ -17,6 +17,7 @@ using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;
using osuTK;
using osu.Game.Rulesets.Mania.Beatmaps;
+using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Mania.UI
{
@@ -145,10 +146,21 @@ namespace osu.Game.Rulesets.Mania.UI
{
var pos = ScrollingInfo.Algorithm.PositionAt(time, Time.Current, ScrollingInfo.TimeRange.Value, HitObjectContainer.DrawHeight);
- if (ScrollingInfo.Direction.Value == ScrollingDirection.Down)
+ switch (ScrollingInfo.Direction.Value)
{
- // as explained above
- pos = HitObjectContainer.DrawHeight - pos;
+ case ScrollingDirection.Down:
+ // We're dealing with screen coordinates in which the position decreases towards the centre of the screen resulting in an increase in start time.
+ // The scrolling algorithm instead assumes a top anchor meaning an increase in time corresponds to an increase in position,
+ // so when scrolling downwards the coordinates need to be flipped.
+ pos = HitObjectContainer.DrawHeight - pos;
+
+ // Blueprints are centred on the mouse position, such that the hitobject position is anchored at the top or bottom of the blueprint depending on the scroll direction.
+ pos -= DefaultNotePiece.NOTE_HEIGHT / 2;
+ break;
+
+ case ScrollingDirection.Up:
+ pos += DefaultNotePiece.NOTE_HEIGHT / 2;
+ break;
}
return HitObjectContainer.ToScreenSpace(new Vector2(HitObjectContainer.DrawWidth / 2, pos));
@@ -159,15 +171,42 @@ namespace osu.Game.Rulesets.Mania.UI
// convert to local space of column so we can snap and fetch correct location.
Vector2 localPosition = HitObjectContainer.ToLocalSpace(screenSpacePosition);
- if (ScrollingInfo.Direction.Value == ScrollingDirection.Down)
+ switch (ScrollingInfo.Direction.Value)
{
- // We're dealing with screen coordinates in which the position decreases towards the centre of the screen resulting in an increase in start time.
- // The scrolling algorithm instead assumes a top anchor meaning an increase in time corresponds to an increase in position,
- // so when scrolling downwards the coordinates need to be flipped.
- localPosition.Y = HitObjectContainer.DrawHeight - localPosition.Y;
+ case ScrollingDirection.Down:
+ // as above
+ localPosition.Y = HitObjectContainer.DrawHeight - localPosition.Y;
+ break;
}
+ // offset for the fact that blueprints are centered, as above.
+ localPosition.Y -= DefaultNotePiece.NOTE_HEIGHT / 2;
+
return ScrollingInfo.Algorithm.TimeAt(localPosition.Y, Time.Current, ScrollingInfo.TimeRange.Value, HitObjectContainer.DrawHeight);
}
+
+ ///
+ /// Converts a mouse position to a hitobject position.
+ ///
+ ///
+ /// Blueprints are centred on the mouse position, such that the hitobject position is anchored at the top or bottom of the blueprint depending on the scroll direction.
+ ///
+ /// The mouse position.
+ /// The resulting hitobject position, acnhored at the top or bottom of the blueprint depending on the scroll direction.
+ private Vector2 mouseToHitObjectPosition(Vector2 mousePosition)
+ {
+ switch (ScrollingInfo.Direction.Value)
+ {
+ case ScrollingDirection.Up:
+ mousePosition.Y -= DefaultNotePiece.NOTE_HEIGHT / 2;
+ break;
+
+ case ScrollingDirection.Down:
+ mousePosition.Y += DefaultNotePiece.NOTE_HEIGHT / 2;
+ break;
+ }
+
+ return mousePosition;
+ }
}
}