mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Fix scrollbar rail clicking being active while popups open
Scrollbars are now also set as the hot item when the rail is hovered and the rail clicking function is now only enabled for the scrollbar that is the hot item. Closes #8954.
This commit is contained in:
parent
dcd02b50bb
commit
8f2c288698
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue