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:
parent
d56accaef1
commit
cef45afbc8
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user