1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

LibGUI: Refine the per-item rects in GItemView

Previously we would consider anything in the large padded area around
each item to also be part of the item for mouse event purposes.
This didn't feel right when rubberbanding, so this patch factors out
the per-item rect computation into a get_item_rects() helper which can
then be used by the various functions that need it.
This commit is contained in:
Andreas Kling 2020-01-04 21:36:42 +01:00
parent 6e21d5c432
commit 5a02a0d140
2 changed files with 51 additions and 19 deletions

View file

@ -39,7 +39,9 @@ private:
int item_count() const;
Rect item_rect(int item_index) const;
int item_at_event_position(const Point&) const;
Vector<int> items_intersecting_rect(const Rect&) const;
void update_content_size();
void get_item_rects(int item_index, const Font&, const GVariant& item_text, Rect& item_rect, Rect& icon_rect, Rect& text_rect) const;
int m_horizontal_padding { 5 };
int m_model_column { 0 };