Fix ItemList click detection gaps
This commit is contained in:
parent
907db8eebc
commit
c892fd8691
1 changed files with 7 additions and 0 deletions
|
@ -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++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
Rect2 rc = items[i].rect_cache;
|
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) {
|
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.
|
rc.size.width = get_size().width - rc.position.x; // Make sure you can still select the last item when clicking past the column.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue