Merge pull request #108706 from KoBeWi/excellent_code_quality
Fix inconsistent column in Tree click detection
This commit is contained in:
@ -6037,13 +6037,22 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < columns.size(); i++) {
|
for (int i = 0; i < columns.size(); i++) {
|
||||||
int w = get_column_width(i);
|
int col_width = get_column_width(i);
|
||||||
if (pos.x < w) {
|
|
||||||
r_column = i;
|
|
||||||
|
|
||||||
|
if (p_item->cells[i].expand_right) {
|
||||||
|
int plus = 1;
|
||||||
|
while (i + plus < columns.size() && !p_item->cells[i + plus].editable && p_item->cells[i + plus].mode == TreeItem::CELL_MODE_STRING && p_item->cells[i + plus].text.is_empty() && p_item->cells[i + plus].icon.is_null() && p_item->cells[i + plus].buttons.is_empty()) {
|
||||||
|
col_width += theme_cache.h_separation;
|
||||||
|
col_width += get_column_width(i + plus);
|
||||||
|
plus++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos.x < col_width) {
|
||||||
|
r_column = i;
|
||||||
return p_item;
|
return p_item;
|
||||||
}
|
}
|
||||||
pos.x -= w;
|
pos.x -= col_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user