diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-07-09 13:14:46 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-07-09 13:15:45 -0300 |
commit | 1d6be8b00d9c46ca748f9465864ce74487c6bc88 (patch) | |
tree | c3e6237e4b402ec4604dbb4f597c2838d8aadc5e | |
parent | 48bdaaa5601e82f242af240fd9eb1b4a7acb79b7 (diff) |
Changed tree so shift-selection skips folded children, closes #5515
-rw-r--r-- | scene/gui/tree.cpp | 8 | ||||
-rw-r--r-- | scene/gui/tree.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index f30b1979ef..a3d6ac9714 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1335,7 +1335,7 @@ int Tree::_count_selected_items(TreeItem* p_from) const { return count; } -void Tree::select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col,TreeItem *p_prev,bool *r_in_range) { +void Tree::select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_col, TreeItem *p_prev, bool *r_in_range, bool p_force_deselect) { TreeItem::Cell &selected_cell=p_selected->cells[p_col]; @@ -1409,7 +1409,7 @@ void Tree::select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col } else { - if (r_in_range && *r_in_range) { + if (r_in_range && *r_in_range && !p_force_deselect) { if (!c.selected && c.selectable) { @@ -1417,7 +1417,7 @@ void Tree::select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col emit_signal("multi_selected",p_current,i,true); } - } else if (!r_in_range){ + } else if (!r_in_range || p_force_deselect){ if (select_mode==SELECT_MULTI && c.selected) emit_signal("multi_selected",p_current,i,false); c.selected=false; @@ -1436,7 +1436,7 @@ void Tree::select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col while (c) { - select_single_item(p_selected,c,p_col,p_prev,r_in_range); + select_single_item(p_selected,c,p_col,p_prev,r_in_range,p_current->is_collapsed() || p_force_deselect); c=c->next; } diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 0172546c1d..f5100ab5b6 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -331,7 +331,7 @@ friend class TreeItem; // void draw_item_text(String p_text,const Ref<Texture>& p_icon,int p_icon_max_w,bool p_tool,Rect2i p_rect,const Color& p_color); void draw_item_rect(const TreeItem::Cell& p_cell,const Rect2i& p_rect,const Color& p_color); int draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2& p_draw_size,TreeItem *p_item); - void select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col,TreeItem *p_prev=NULL,bool *r_in_range=NULL); + void select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col,TreeItem *p_prev=NULL,bool *r_in_range=NULL,bool p_force_deselect=false); int propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_doubleclick,TreeItem *p_item,int p_button,const InputModifierState& p_mod); void text_editor_enter(String p_text); void _text_editor_modal_close(); |