1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Add a simple hover state

This commit is contained in:
Dean Herbert 2020-02-05 15:33:04 +09:00
parent d56accaef1
commit cef45afbc8

View File

@ -23,6 +23,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private readonly Container extensionBar;
protected override bool ShouldBeConsideredForInput(Drawable child) => true;
[UsedImplicitly]
private readonly Bindable<double> startTime;
@ -105,6 +107,45 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
};
}
protected override bool OnHover(HoverEvent e)
{
updateState();
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
updateState();
base.OnHoverLost(e);
}
private bool hasMouseDown;
protected override bool OnMouseDown(MouseDownEvent e)
{
hasMouseDown = true;
updateState();
return true;
}
protected override void OnMouseUp(MouseUpEvent e)
{
hasMouseDown = false;
updateState();
base.OnMouseUp(e);
}
private void updateState()
{
if (IsHovered || hasMouseDown)
Colour = Color4.Orange;
else
{
Colour = Color4.White;
}
}
protected override bool OnDragStart(DragStartEvent e) => true;
[Resolved]