mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibGUI: Tighten paint invalidation rects in item views :^)
AbstractView now has a paint_invalidation_rect(index) function that subclasses can override to provide a tighter invalidation rect for an index.
This commit is contained in:
parent
148e72bfa0
commit
df96380121
9 changed files with 48 additions and 1 deletions
|
@ -717,4 +717,20 @@ int TreeView::tree_column_x_offset() const
|
|||
return offset;
|
||||
}
|
||||
|
||||
Gfx::IntRect TreeView::content_rect(ModelIndex const& index) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return {};
|
||||
|
||||
Gfx::IntRect found_rect;
|
||||
traverse_in_paint_order([&](ModelIndex const& current_index, Gfx::IntRect const& rect, Gfx::IntRect const&, int) {
|
||||
if (index == current_index) {
|
||||
found_rect = rect;
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return found_rect;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue