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

Method MoveVerticalScroll

libraries/ZWidget/src/widgets/textedit/textedit.cpp:610–623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608}
609
610void TextEdit::MoveVerticalScroll()
611{
612 double total_height = GetTotalLineHeight();
613 double height_per_line = std::max(1.0, total_height / std::max((size_t)1, lines.size()));
614 int lines_fit = (int)(GetHeight() / height_per_line);
615 if (cursor_pos.y >= vert_scrollbar->GetPosition() + lines_fit)
616 {
617 vert_scrollbar->SetPosition(cursor_pos.y - lines_fit + 1);
618 }
619 else if (cursor_pos.y < vert_scrollbar->GetPosition())
620 {
621 vert_scrollbar->SetPosition(cursor_pos.y);
622 }
623}
624
625double TextEdit::GetTotalLineHeight()
626{

Callers

nothing calls this directly

Calls 4

GetHeightFunction · 0.85
sizeMethod · 0.45
GetPositionMethod · 0.45
SetPositionMethod · 0.45

Tested by

no test coverage detected