mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +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:
committed by
Ali Mohammad Pur
parent
5759b25ca8
commit
11dffbd96f
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user