From cef45afbc85eb24bad74f44d1e8d4c8d16913b86 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Feb 2020 15:33:04 +0900 Subject: [PATCH] Add a simple hover state --- .../Timeline/TimelineHitObjectBlueprint.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs index b2da1577d0..8a6dd40bde 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs @@ -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 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]