mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 08:02:13 +00:00
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:
parent
5759b25ca8
commit
11dffbd96f
3 changed files with 11 additions and 4 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue