Tree: fix RMB click collapses next item

This commit is contained in:
Poommetee Ketson 2017-08-26 23:55:43 +07:00
parent 1894157c9f
commit 5e889cce4f

View file

@ -2473,22 +2473,24 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
Point2 pos = b->get_position() - bg->get_offset(); Point2 pos = b->get_position() - bg->get_offset();
cache.click_type = Cache::CLICK_NONE; cache.click_type = Cache::CLICK_NONE;
if (show_column_titles && b->get_button_index() == BUTTON_LEFT) { if (show_column_titles) {
pos.y -= _get_title_button_height(); pos.y -= _get_title_button_height();
if (pos.y < 0) { if (pos.y < 0) {
pos.x += cache.offset.x; if (b->get_button_index() == BUTTON_LEFT) {
int len = 0; pos.x += cache.offset.x;
for (int i = 0; i < columns.size(); i++) { int len = 0;
for (int i = 0; i < columns.size(); i++) {
len += get_column_width(i); len += get_column_width(i);
if (pos.x < len) { if (pos.x < len) {
cache.click_type = Cache::CLICK_TITLE; cache.click_type = Cache::CLICK_TITLE;
cache.click_index = i; cache.click_index = i;
//cache.click_id=; //cache.click_id=;
update(); update();
break; break;
}
} }
} }
break; break;