1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:35:07 +00:00

LibGUI: Use wrapped text rect for paint invalidation

This fixes an issue where after anything past first line would not get
invalidated after unhovering an icon.
This commit is contained in:
LuK1337 2021-07-12 14:18:21 +02:00 committed by Andreas Kling
parent 4db286e63f
commit d940f7ba4f
2 changed files with 14 additions and 1 deletions

View file

@ -404,6 +404,14 @@ Gfx::IntRect IconView::editing_rect(ModelIndex const& index) const
return item_data.text_rect.inflated(4, 4);
}
Gfx::IntRect IconView::paint_invalidation_rect(const ModelIndex& index) const
{
if (!index.is_valid())
return {};
auto& item_data = get_item_data(index.row());
return item_data.rect(true);
}
void IconView::did_change_hovered_index(const ModelIndex& old_index, const ModelIndex& new_index)
{
AbstractView::did_change_hovered_index(old_index, new_index);
@ -462,6 +470,7 @@ void IconView::get_item_rects(int item_index, ItemData& item_data, const Gfx::Fo
item_data.text_rect.intersect(item_rect);
item_data.text_rect.set_height(font.glyph_height() * item_data.wrapped_text_lines.size());
item_data.text_rect.inflate(6, 4);
item_data.text_rect_wrapped = item_data.text_rect;
} else {
item_data.text_rect.set_width(unwrapped_text_width);
item_data.text_rect.inflate(6, 4);