From 5e889cce4f113410431278cd00aaea8c6c7366a3 Mon Sep 17 00:00:00 2001 From: Poommetee Ketson Date: Sat, 26 Aug 2017 23:55:43 +0700 Subject: Tree: fix RMB click collapses next item --- scene/gui/tree.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'scene') diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 20bf818d44..38cd425a89 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2473,22 +2473,24 @@ void Tree::_gui_input(Ref p_event) { Point2 pos = b->get_position() - bg->get_offset(); 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(); if (pos.y < 0) { - pos.x += cache.offset.x; - int len = 0; - for (int i = 0; i < columns.size(); i++) { - - len += get_column_width(i); - if (pos.x < len) { - - cache.click_type = Cache::CLICK_TITLE; - cache.click_index = i; - //cache.click_id=; - update(); - break; + if (b->get_button_index() == BUTTON_LEFT) { + pos.x += cache.offset.x; + int len = 0; + for (int i = 0; i < columns.size(); i++) { + + len += get_column_width(i); + if (pos.x < len) { + + cache.click_type = Cache::CLICK_TITLE; + cache.click_index = i; + //cache.click_id=; + update(); + break; + } } } break; -- cgit v1.2.3