1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 10:14:58 +00:00

LibGUI: Improve and simplify IconView item name wrapping

Move the wrapping logic to get_item_rects(). This makes mouse events
able to hit the wrapped labels, and various other little things stop
glitching out as well.

Also, instead of having a per-line width when wrapping icon names,
make the text rect wide enough to fit every line.
This commit is contained in:
Andreas Kling 2020-10-27 16:10:30 +01:00
parent 7112031bfb
commit 272af7685b
4 changed files with 78 additions and 43 deletions

View file

@ -242,7 +242,9 @@ void AbstractView::set_hovered_index(const ModelIndex& index)
{
if (m_hovered_index == index)
return;
auto old_index = m_hovered_index;
m_hovered_index = index;
did_change_hovered_index(old_index, index);
update();
}
@ -445,7 +447,9 @@ void AbstractView::set_cursor(ModelIndex index, SelectionUpdate selection_update
// FIXME: Support the other SelectionUpdate types
auto old_cursor_index = m_cursor_index;
m_cursor_index = index;
did_change_cursor_index(old_cursor_index, m_cursor_index);
if (scroll_cursor_into_view)
scroll_into_view(index, true, true);