MCPcopy Create free account
hub / github.com/ZDoom/Raze / ScrollToItem

Method ScrollToItem

libraries/ZWidget/src/widgets/listview/listview.cpp:35–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void ListView::ScrollToItem(int index)
36{
37 double itemHeight = 20.0;
38 double y = itemHeight * index;
39 if (y < scrollbar->GetPosition())
40 {
41 scrollbar->SetPosition(y);
42 }
43 else if (y + itemHeight > scrollbar->GetPosition() + GetHeight())
44 {
45 scrollbar->SetPosition(std::max(y + itemHeight - GetHeight(), 0.0));
46 }
47}
48
49void ListView::OnScrollbarScroll()
50{

Callers 1

PlayGamePageMethod · 0.80

Calls 3

GetHeightFunction · 0.85
GetPositionMethod · 0.45
SetPositionMethod · 0.45

Tested by

no test coverage detected