Skip to content

Commit 7d2b309

Browse files
committed
add: atEnd state for scroll region
1 parent 7f4a076 commit 7d2b309

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/game/client/ui_scrollregion.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,12 @@ bool CScrollRegion::Active() const
284284
{
285285
return Ui()->ActiveItem() == &m_ScrollY;
286286
}
287+
288+
bool CScrollRegion::AtEnd() const
289+
{
290+
if(m_ContentH <= m_ClipRect.h)
291+
return true;
292+
293+
const float MaxScroll = m_ContentH - m_ClipRect.h;
294+
return (m_ScrollY >= MaxScroll - 1.0f);
295+
}

src/game/client/ui_scrollregion.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class CScrollRegion : private CUIElementBase
142142
bool ScrollbarShown() const;
143143
bool Animating() const;
144144
bool Active() const;
145+
bool AtEnd() const;
145146
const CScrollRegionParams &Params() const { return m_Params; }
146147
};
147148

0 commit comments

Comments
 (0)