MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / scrollToCursor

Method scrollToCursor

switch/source/MainScreen.cpp:252–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252void MainScreen::scrollToCursor(size_t count)
253{
254 const int totalRows = count == 0 ? 0 : (int)((count - 1) / GRID_COLS) + 1;
255 const int maxScroll = std::max(0, totalRows - GRID_FULL_ROWS);
256 const int row = count == 0 ? 0 : (int)(mCursor / GRID_COLS);
257 if (row < mScrollRow) {
258 mScrollRow = row;
259 }
260 else if (row > mScrollRow + GRID_FULL_ROWS - 1) {
261 mScrollRow = row - (GRID_FULL_ROWS - 1);
262 }
263 mScrollRow = std::clamp(mScrollRow, 0, maxScroll);
264}
265
266void MainScreen::updateGridCursor(const InputState& input, size_t count)
267{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected