Skip to content

Commit f74d989

Browse files
committed
upd: scroll region rect check
1 parent 253484d commit f74d989

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/game/client/ui_scrollregion.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,12 @@ bool CScrollRegion::Active() const
285285
return Ui()->ActiveItem() == &m_ScrollY;
286286
}
287287

288-
bool CScrollRegion::AtEnd() const
288+
bool CScrollRegion::AtEnd(const CUIRect &Rect) const
289289
{
290290
if(m_ContentH <= m_ClipRect.h)
291291
return true;
292292

293-
const float MaxScroll = m_ContentH - m_ClipRect.h;
294-
return (m_ScrollY >= MaxScroll - 1.0f);
293+
float VisibleBottom = m_ScrollY + m_ClipRect.h;
294+
float RectBottom = Rect.y + Rect.h;
295+
return RectBottom >= VisibleBottom - 1.0f;
295296
}

src/game/client/ui_scrollregion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class CScrollRegion : private CUIElementBase
142142
bool ScrollbarShown() const;
143143
bool Animating() const;
144144
bool Active() const;
145-
bool AtEnd() const;
145+
bool AtEnd(const CUIRect &Rect) const;
146146
const CScrollRegionParams &Params() const { return m_Params; }
147147
};
148148

0 commit comments

Comments
 (0)