LibGUI: Add some "fudge factor" around IconView item rects
Previously there was a dead zone between the item icon and its text in IconViews. This meant that you could click between the icon and the text label and hit nothing. This patch improves the situation by inflating both rects so that they both overlap and become a bit easier to hit.
This commit is contained in:
parent
75a41da69f
commit
4a8d47edf8
Notes:
sideshowbarker
2024-07-18 08:02:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4a8d47edf8c
1 changed files with 5 additions and 2 deletions
|
@ -80,16 +80,19 @@ private:
|
|||
text = {};
|
||||
}
|
||||
|
||||
Gfx::IntRect hot_icon_rect() const { return icon_rect.inflated(10, 10); }
|
||||
Gfx::IntRect hot_text_rect() const { return text_rect.inflated(2, 2); }
|
||||
|
||||
bool is_intersecting(const Gfx::IntRect& rect) const
|
||||
{
|
||||
VERIFY(valid);
|
||||
return icon_rect.intersects(rect) || text_rect.intersects(rect);
|
||||
return hot_icon_rect().intersects(rect) || hot_text_rect().intersects(rect);
|
||||
}
|
||||
|
||||
bool is_containing(const Gfx::IntPoint& point) const
|
||||
{
|
||||
VERIFY(valid);
|
||||
return icon_rect.contains(point) || text_rect.contains(point);
|
||||
return hot_icon_rect().contains(point) || hot_text_rect().contains(point);
|
||||
}
|
||||
|
||||
Gfx::IntRect rect(bool wrapped = false) const
|
||||
|
|
Loading…
Add table
Reference in a new issue