MCPcopy Create free account
hub / github.com/ddnet/ddnet / ScrollHere

Method ScrollHere

src/game/client/ui_scrollregion.cpp:215–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215void CScrollRegion::ScrollHere(EScrollOption Option)
216{
217 const float MinHeight = minimum(m_ClipRect.h, m_LastAddedRect.h);
218 const float TopScroll = m_LastAddedRect.y - (m_ClipRect.y + m_ContentScrollOff.y);
219
220 switch(Option)
221 {
222 case SCROLLHERE_TOP:
223 m_RequestScrollY = TopScroll;
224 break;
225
226 case SCROLLHERE_BOTTOM:
227 m_RequestScrollY = TopScroll - (m_ClipRect.h - MinHeight);
228 break;
229
230 case SCROLLHERE_KEEP_IN_VIEW:
231 default:
232 const float DeltaY = m_LastAddedRect.y - m_ClipRect.y;
233 if(DeltaY < 0)
234 m_RequestScrollY = TopScroll;
235 else if(DeltaY > (m_ClipRect.h - MinHeight))
236 m_RequestScrollY = TopScroll - (m_ClipRect.h - MinHeight);
237 break;
238 }
239}
240
241void CScrollRegion::ScrollRelative(EScrollRelative Direction, float SpeedMultiplier)
242{

Callers 1

DoNextRowMethod · 0.80

Calls 1

minimumFunction · 0.50

Tested by

no test coverage detected