Merge pull request #8956 from Robyt3/UI-Scrollbar-Rail-HotItem

Fix scrollbar rail clicking being active while popups open
This commit is contained in:
Dennis Felsing 2024-09-15 10:21:41 +00:00 committed by GitHub
commit 0f12044fcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1300,6 +1300,8 @@ float CUi::DoScrollbarV(const void *pId, const CUIRect *pRect, float Current)
} }
} }
else if(HotItem() == pId) else if(HotItem() == pId)
{
if(InsideHandle)
{ {
if(MouseButton(0)) if(MouseButton(0))
{ {
@ -1308,14 +1310,15 @@ float CUi::DoScrollbarV(const void *pId, const CUIRect *pRect, float Current)
Grabbed = true; Grabbed = true;
} }
} }
else if(MouseButtonClicked(0) && !InsideHandle && InsideRail) else if(MouseButtonClicked(0))
{ {
SetActiveItem(pId); SetActiveItem(pId);
m_ActiveScrollbarOffset = Handle.h / 2.0f; m_ActiveScrollbarOffset = Handle.h / 2.0f;
Grabbed = true; Grabbed = true;
} }
}
if(InsideHandle && !MouseButton(0)) if(InsideRail && !MouseButton(0))
{ {
SetHotItem(pId); SetHotItem(pId);
} }
@ -1379,6 +1382,8 @@ float CUi::DoScrollbarH(const void *pId, const CUIRect *pRect, float Current, co
} }
} }
else if(HotItem() == pId) else if(HotItem() == pId)
{
if(InsideHandle)
{ {
if(MouseButton(0)) if(MouseButton(0))
{ {
@ -1387,12 +1392,13 @@ float CUi::DoScrollbarH(const void *pId, const CUIRect *pRect, float Current, co
Grabbed = true; Grabbed = true;
} }
} }
else if(MouseButtonClicked(0) && !InsideHandle && InsideRail) else if(MouseButtonClicked(0))
{ {
SetActiveItem(pId); SetActiveItem(pId);
m_ActiveScrollbarOffset = Handle.w / 2.0f; m_ActiveScrollbarOffset = Handle.w / 2.0f;
Grabbed = true; Grabbed = true;
} }
}
if(!pColorInner && (InsideHandle || Grabbed) && (CheckActiveItem(pId) || HotItem() == pId)) if(!pColorInner && (InsideHandle || Grabbed) && (CheckActiveItem(pId) || HotItem() == pId))
{ {
@ -1400,7 +1406,7 @@ float CUi::DoScrollbarH(const void *pId, const CUIRect *pRect, float Current, co
Handle.y -= 1.5f; Handle.y -= 1.5f;
} }
if(InsideHandle && !MouseButton(0)) if(InsideRail && !MouseButton(0))
{ {
SetHotItem(pId); SetHotItem(pId);
} }