Merge pull request #8353 from Robyt3/Client-Demo-Seekbar-UX-Fixes

Fix demo seekbar tooltip not shown while seekbar is active, fix demo seekbar being activated by held button press
This commit is contained in:
heinrich5991 2024-05-12 01:45:33 +00:00 committed by GitHub
commit 0562be67f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
if(Inside && !Ui()->MouseButton(0))
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;