diff --git a/src/game/client/ui_scrollregion.cpp b/src/game/client/ui_scrollregion.cpp index 12e9598bf..e8ddb281c 100644 --- a/src/game/client/ui_scrollregion.cpp +++ b/src/game/client/ui_scrollregion.cpp @@ -184,8 +184,8 @@ void CScrollRegion::End() bool CScrollRegion::AddRect(const CUIRect &Rect, bool ShouldScrollHere) { m_LastAddedRect = Rect; - // Round up and add 1 to fix pixel clipping at the end of the scrolling area - m_ContentH = maximum(std::ceil(Rect.y + Rect.h - (m_ClipRect.y + m_ContentScrollOff.y)) + 1.0f, m_ContentH); + // Round up and add magic to fix pixel clipping at the end of the scrolling area + m_ContentH = maximum(std::ceil(Rect.y + Rect.h - (m_ClipRect.y + m_ContentScrollOff.y)) + HEIGHT_MAGIC_FIX, m_ContentH); if(ShouldScrollHere) ScrollHere(); return !IsRectClipped(Rect); diff --git a/src/game/client/ui_scrollregion.h b/src/game/client/ui_scrollregion.h index 679c30720..83b205d3d 100644 --- a/src/game/client/ui_scrollregion.h +++ b/src/game/client/ui_scrollregion.h @@ -89,6 +89,10 @@ Usage: class CScrollRegion : private CUIElementBase { public: + // TODO: Properly fix whatever is causing the 1-pixel discrepancy in scrolling rect height and remove this magic value. + // Currently this must be added when calculating the required height of a UI rect for a scroll region to get a perfect fit. + static constexpr float HEIGHT_MAGIC_FIX = 1.0f; + enum EScrollRelative { SCROLLRELATIVE_UP = -1,