Spreadsheet+LibGUI: Calculate cell position given scroll position

Take into account the current scroll position when calculating the
position of cells. This way when the user scrolls either horizontally
or vertically, the calculations done to find the cell position
will be correct.
This commit is contained in:
martinfalisse 2022-03-07 16:26:21 +01:00 committed by Ali Mohammad Pur
commit 11dffbd96f
Notes: sideshowbarker 2024-07-17 17:08:08 +09:00
3 changed files with 11 additions and 4 deletions

View file

@ -326,6 +326,12 @@ Gfx::IntRect AbstractTableView::content_rect(const ModelIndex& index) const
return content_rect(index.row(), index.column());
}
Gfx::IntRect AbstractTableView::content_rect_minus_scrollbars(const ModelIndex& index) const
{
auto naive_content_rect = content_rect(index.row(), index.column());
return { naive_content_rect.x() - horizontal_scrollbar().value(), naive_content_rect.y() - vertical_scrollbar().value(), naive_content_rect.width(), naive_content_rect.height() };
}
Gfx::IntRect AbstractTableView::row_rect(int item_index) const
{
return { row_header().is_visible() ? row_header().width() : 0,