mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 14:53:01 +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;
|
private readonly Container extensionBar;
|
||||||
|
|
||||||
|
protected override bool ShouldBeConsideredForInput(Drawable child) => true;
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
private readonly Bindable<double> startTime;
|
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;
|
protected override bool OnDragStart(DragStartEvent e) => true;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
|
Loading…
Reference in New Issue
Block a user