From ca091d87b2d87de0c78dc1e3d83bb43ac7c7c8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 13 May 2022 21:34:46 +0200 Subject: [PATCH] Support nesting editboxes, pickers and scrollbars in clipping areas --- src/game/client/ui.cpp | 4 +--- src/game/client/ui_ex.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp index ec533483c..da31972b7 100644 --- a/src/game/client/ui.cpp +++ b/src/game/client/ui.cpp @@ -466,9 +466,7 @@ int CUI::DoButtonLogic(const void *pID, int Checked, const CUIRect *pRect) int CUI::DoPickerLogic(const void *pID, const CUIRect *pRect, float *pX, float *pY) { - const bool Inside = MouseInside(pRect); - - if(Inside) + if(MouseHovered(pRect)) SetHotItem(pID); if(HotItem() == pID && MouseButtonClicked(0)) diff --git a/src/game/client/ui_ex.cpp b/src/game/client/ui_ex.cpp index 282ce9099..347b77ff5 100644 --- a/src/game/client/ui_ex.cpp +++ b/src/game/client/ui_ex.cpp @@ -57,8 +57,8 @@ float CUIEx::DoScrollbarV(const void *pID, const CUIRect *pRect, float Current) // logic static float s_OffsetY; - const bool InsideRail = UI()->MouseInside(&Rail); - const bool InsideHandle = UI()->MouseInside(&Handle); + const bool InsideRail = UI()->MouseHovered(&Rail); + const bool InsideHandle = UI()->MouseHovered(&Handle); bool Grabbed = false; // whether to apply the offset if(UI()->ActiveItem() == pID) @@ -137,8 +137,8 @@ float CUIEx::DoScrollbarH(const void *pID, const CUIRect *pRect, float Current, // logic static float s_OffsetX; - const bool InsideRail = UI()->MouseInside(&Rail); - const bool InsideHandle = UI()->MouseInside(&Handle); + const bool InsideRail = UI()->MouseHovered(&Rail); + const bool InsideHandle = UI()->MouseHovered(&Handle); bool Grabbed = false; // whether to apply the offset if(UI()->ActiveItem() == pID) @@ -214,7 +214,7 @@ float CUIEx::DoScrollbarH(const void *pID, const CUIRect *pRect, float Current, bool CUIEx::DoEditBox(const void *pID, const CUIRect *pRect, char *pStr, unsigned StrSize, float FontSize, float *pOffset, bool Hidden, int Corners, const SUIExEditBoxProperties &Properties) { - const bool Inside = UI()->MouseInside(pRect); + const bool Inside = UI()->MouseHovered(pRect); bool ReturnValue = false; bool UpdateOffset = false;