mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Make sizing happen per-blueprint
This commit is contained in:
parent
d9b8d2d15c
commit
8071244d97
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -22,6 +23,11 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected Vector2 SnappedMousePosition { get; private set; }
|
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]
|
[Resolved]
|
||||||
private IManiaHitObjectComposer composer { get; set; }
|
private IManiaHitObjectComposer composer { get; set; }
|
||||||
|
|
||||||
@ -42,7 +48,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
SnappedMousePosition = e.MousePosition;
|
SnappedMousePosition = e.MousePosition;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Width = column.DrawWidth;
|
SnappedWidth = column.DrawWidth;
|
||||||
|
|
||||||
// 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)));
|
||||||
@ -80,10 +86,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
switch (scrollingInfo.Direction.Value)
|
switch (scrollingInfo.Direction.Value)
|
||||||
{
|
{
|
||||||
case ScrollingDirection.Up:
|
case ScrollingDirection.Up:
|
||||||
position.Y -= DrawHeight / 2;
|
position.Y -= NotePiece.NOTE_HEIGHT / 2;
|
||||||
break;
|
break;
|
||||||
case ScrollingDirection.Down:
|
case ScrollingDirection.Down:
|
||||||
position.Y += DrawHeight / 2;
|
position.Y += NotePiece.NOTE_HEIGHT / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
|
Width = SnappedWidth;
|
||||||
Position = SnappedMousePosition;
|
Position = SnappedMousePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user