1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 04:02:55 +08:00

Lock spinners to centre of screen

This commit is contained in:
smoogipoo 2018-11-01 19:24:58 +09:00
parent 1265d5ac0b
commit 2ac4f2b6af

View File

@ -6,6 +6,7 @@ using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks
{
@ -18,19 +19,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks
private bool isPlacingEnd;
public SpinnerPlacementMask()
: base(new Spinner())
: base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
{
InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f };
}
protected override void LoadComplete()
{
base.LoadComplete();
// Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame
HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position;
}
protected override bool OnClick(ClickEvent e)
{
if (isPlacingEnd)
@ -48,12 +41,5 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks
return true;
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
if (!isPlacingEnd)
HitObject.Position = e.MousePosition;
return true;
}
}
}