Merge pull request from madmiraal/fix-40947

Check if old mouse column is still available.
This commit is contained in:
Rémi Verschelde 2020-09-08 13:36:32 +02:00 committed by GitHub
commit 5cc8da9f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2403,6 +2403,10 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
cache.hover_cell = col; cache.hover_cell = col;
if (it != old_it || col != old_col) { if (it != old_it || col != old_col) {
if (old_it && old_col >= old_it->cells.size()) {
// Columns may have changed since last update().
update();
} else {
// Only need to update if mouse enters/exits a button // Only need to update if mouse enters/exits a button
bool was_over_button = old_it && old_it->cells[old_col].custom_button; bool was_over_button = old_it && old_it->cells[old_col].custom_button;
bool is_over_button = it && it->cells[col].custom_button; bool is_over_button = it && it->cells[col].custom_button;
@ -2412,6 +2416,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
} }
} }
} }
}
// Update if mouse enters/exits columns // Update if mouse enters/exits columns
if (cache.hover_type != old_hover || cache.hover_index != old_index) { if (cache.hover_type != old_hover || cache.hover_index != old_index) {