1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-24 04:07:26 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Edit/Blueprints/TaikoSelectionBlueprint.cs
2020-05-30 15:24:44 +09:00

41 lines
1.3 KiB
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
{
public class TaikoSelectionBlueprint : OverlaySelectionBlueprint
{
public TaikoSelectionBlueprint(DrawableHitObject hitObject)
: base(hitObject)
{
RelativeSizeAxes = Axes.None;
AddInternal(new HitPiece
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopLeft
});
}
protected override void Update()
{
base.Update();
// Move the rectangle to cover the hitobjects
var topLeft = new Vector2(float.MaxValue, float.MaxValue);
var bottomRight = new Vector2(float.MinValue, float.MinValue);
topLeft = Vector2.ComponentMin(topLeft, Parent.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.TopLeft));
bottomRight = Vector2.ComponentMax(bottomRight, Parent.ToLocalSpace(DrawableObject.ScreenSpaceDrawQuad.BottomRight));
Size = bottomRight - topLeft;
Position = topLeft;
}
}
}