summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-02-15 17:35:54 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-02-15 17:35:54 +0100
commitd48c450c62573b48ecc097b02a75421a6bbe1bac (patch)
tree3c498ef98289854c937bdfc6232c504f37e46008
parenta00d810c83329f077d2bdb160c13d824134a91e5 (diff)
parentc892fd8691914f6c4aecd9ce16099dd9674b93b8 (diff)
downloadredot-engine-d48c450c62573b48ecc097b02a75421a6bbe1bac.tar.gz
Merge pull request #88347 from davthedev/itemlist-click-gap-fix
Fix ItemList click detection gaps
-rw-r--r--scene/gui/item_list.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 588bfb6b04..162c9cf801 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1495,6 +1495,13 @@ int ItemList::get_item_at_position(const Point2 &p_pos, bool p_exact) const {
for (int i = 0; i < items.size(); i++) {
Rect2 rc = items[i].rect_cache;
+
+ // Grow the detection rectangle to match the grown selection indicator.
+ rc.position.y -= theme_cache.v_separation / 2;
+ rc.size.y += theme_cache.v_separation;
+ rc.position.x -= theme_cache.h_separation / 2;
+ rc.size.x += theme_cache.h_separation;
+
if (i % current_columns == current_columns - 1) {
rc.size.width = get_size().width - rc.position.x; // Make sure you can still select the last item when clicking past the column.
}