1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 11:12:55 +08:00
osu-lazer/osu.Game/Screens/Edit/Compose/Components/SelectionBoxDragHandle.cs
2021-05-05 21:50:16 +03:00

69 lines
1.7 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 System;
using osu.Framework.Input.Events;
namespace osu.Game.Screens.Edit.Compose.Components
{
public abstract class SelectionBoxDragHandle : SelectionBoxControl
{
public Action<DragEvent> HandleDrag { get; set; }
protected override bool OnDragStart(DragStartEvent e)
{
TriggerOperationStarted();
return true;
}
protected override void OnDrag(DragEvent e)
{
HandleDrag?.Invoke(e);
base.OnDrag(e);
}
protected override void OnDragEnd(DragEndEvent e)
{
TriggerOperatoinEnded();
UpdateHoverState();
base.OnDragEnd(e);
}
#region Internal events for SelectionBoxDragHandleContainer
internal event Action HoverGained;
internal event Action HoverLost;
internal event Action MouseDown;
internal event Action MouseUp;
protected override bool OnHover(HoverEvent e)
{
bool result = base.OnHover(e);
HoverGained?.Invoke();
return result;
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
HoverLost?.Invoke();
}
protected override bool OnMouseDown(MouseDownEvent e)
{
bool result = base.OnMouseDown(e);
MouseDown?.Invoke();
return result;
}
protected override void OnMouseUp(MouseUpEvent e)
{
base.OnMouseUp(e);
MouseUp?.Invoke();
}
#endregion
}
}