1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Make sizing happen per-blueprint

This commit is contained in:
smoogipoo 2018-11-19 18:40:16 +09:00
parent d9b8d2d15c
commit 8071244d97
2 changed files with 10 additions and 3 deletions

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI.Scrolling;
using OpenTK;
@ -22,6 +23,11 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
/// </summary>
protected Vector2 SnappedMousePosition { get; private set; }
/// <summary>
/// The width of the closest column to the current mouse position.
/// </summary>
protected float SnappedWidth { get; private set; }
[Resolved]
private IManiaHitObjectComposer composer { get; set; }
@ -42,7 +48,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
SnappedMousePosition = e.MousePosition;
else
{
Width = column.DrawWidth;
SnappedWidth = column.DrawWidth;
// Snap to the column
var parentPos = Parent.ToLocalSpace(column.ToScreenSpace(new Vector2(column.DrawWidth / 2, 0)));
@ -80,10 +86,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
switch (scrollingInfo.Direction.Value)
{
case ScrollingDirection.Up:
position.Y -= DrawHeight / 2;
position.Y -= NotePiece.NOTE_HEIGHT / 2;
break;
case ScrollingDirection.Down:
position.Y += DrawHeight / 2;
position.Y += NotePiece.NOTE_HEIGHT / 2;
break;
}

View File

@ -25,6 +25,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
base.Update();
Width = SnappedWidth;
Position = SnappedMousePosition;
}