From 7d0774a00d228497f54927bdb9daec060319d4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 11 May 2024 12:22:40 +0200 Subject: [PATCH] Fix demo seekbar tooltip not shown while seekbar is active The tooltip was not shown if the seekbar is the active item, i.e. when the first mouse button is held down and the seekbar is currently updating the demo player. --- src/game/client/components/menus_demo.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index 6d3ef8e61..38643fcfd 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -487,17 +487,18 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) { Ui()->SetActiveItem(pId); } - else - { - const int HoveredTick = (int)(clamp((Ui()->MouseX() - SeekBar.x - Rounding) / (float)(SeekBar.w - 2 * Rounding), 0.0f, 1.0f) * TotalTicks); - static char s_aHoveredTime[32]; - str_time((int64_t)HoveredTick / Client()->GameTickSpeed() * 100, TIME_HOURS, s_aHoveredTime, sizeof(s_aHoveredTime)); - GameClient()->m_Tooltips.DoToolTip(pId, &SeekBar, s_aHoveredTime); - } } if(Inside) Ui()->SetHotItem(pId); + + if(Ui()->HotItem() == pId) + { + const int HoveredTick = (int)(clamp((Ui()->MouseX() - SeekBar.x - Rounding) / (float)(SeekBar.w - 2 * Rounding), 0.0f, 1.0f) * TotalTicks); + static char s_aHoveredTime[32]; + str_time((int64_t)HoveredTick / Client()->GameTickSpeed() * 100, TIME_HOURS, s_aHoveredTime, sizeof(s_aHoveredTime)); + GameClient()->m_Tooltips.DoToolTip(pId, &SeekBar, s_aHoveredTime); + } } bool IncreaseDemoSpeed = false, DecreaseDemoSpeed = false;