Merge branch 'ellenhp/godot-accessibility-fix_tree_multiselect'

This commit is contained in:
Nolan Darilek 2019-10-17 09:41:41 -05:00
commit b7facbdf69

View File

@ -263,11 +263,12 @@ func tree_item_deselect_all(item: TreeItem):
for i in range(node.columns): for i in range(node.columns):
item.deselect(i) item.deselect(i)
func tree_deselect_all_but(target: TreeItem, item: TreeItem): func tree_deselect_all_but(target: TreeItem, tree: Tree):
var next = item.get_next_visible() var cur = tree.get_root()
while next and next != item: while cur != null:
tree_item_deselect_all(item) if cur != target:
next = next.get_next_visible() tree_item_deselect_all(cur)
cur = tree.get_next_selected(cur)
var prev_selected_cell var prev_selected_cell
@ -279,7 +280,7 @@ func tree_item_selected():
if cell != prev_selected_cell: if cell != prev_selected_cell:
if node.select_mode == Tree.SELECT_MULTI: if node.select_mode == Tree.SELECT_MULTI:
cell.select(0) cell.select(0)
tree_deselect_all_but(cell, node.get_root()) tree_deselect_all_but(cell, node)
if node.has_focus(): if node.has_focus():
tree_item_render() tree_item_render()
prev_selected_cell = cell prev_selected_cell = cell