Move selection events to BlueprintContainer

This commit is contained in:
smoogipoo
2019-10-24 14:58:02 +09:00
parent 714c89faa4
commit e04c77178c
2 changed files with 19 additions and 37 deletions

View File

@ -6,8 +6,6 @@ using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
@ -29,12 +27,6 @@ namespace osu.Game.Rulesets.Edit
/// </summary>
public event Action<SelectionBlueprint> Deselected;
/// <summary>
/// Invoked when this <see cref="SelectionBlueprint"/> has requested selection.
/// Will fire even if already selected. Does not actually perform selection.
/// </summary>
public event Action<SelectionBlueprint, InputState> SelectionRequested;
/// <summary>
/// The <see cref="DrawableHitObject"/> which this <see cref="SelectionBlueprint"/> applies to.
/// </summary>
@ -99,33 +91,6 @@ namespace osu.Game.Rulesets.Edit
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => DrawableObject.ReceivePositionalInputAt(screenSpacePos);
private bool selectionRequested;
protected override bool OnMouseDown(MouseDownEvent e)
{
selectionRequested = false;
if (State == SelectionState.NotSelected)
{
SelectionRequested?.Invoke(this, e.CurrentState);
selectionRequested = true;
}
return IsSelected;
}
protected override bool OnClick(ClickEvent e)
{
if (State == SelectionState.Selected && !selectionRequested)
{
selectionRequested = true;
SelectionRequested?.Invoke(this, e.CurrentState);
return true;
}
return base.OnClick(e);
}
/// <summary>
/// The screen-space point that causes this <see cref="SelectionBlueprint"/> to be selected.
/// </summary>