mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-12-22 07:35:56 +00:00
For trees allowing multiple selection, force selection of a single row for now.
I'm not immediately sure how to present multiple tree selections. I also don't know if I can control selection status from the input events. So, for the time being, we force a single row to be selected. This isn't the most ideal solution, but it makes debugging other issues easier, so I'll use it for now to unblock other work.
This commit is contained in:
parent
f11edefdb5
commit
77db176e20
|
@ -219,6 +219,20 @@ func tree_item_render():
|
|||
tokens.append("selected")
|
||||
tts.speak(tokens.join(": "), true)
|
||||
|
||||
func tree_item_deselect_all(item: TreeItem):
|
||||
for i in range(node.columns):
|
||||
item.deselect(i)
|
||||
|
||||
func tree_deselect_all_but(target: TreeItem, item: TreeItem):
|
||||
if item != target:
|
||||
tree_item_deselect_all(item)
|
||||
if item.get_children():
|
||||
tree_deselect_all_but(target, item.get_children())
|
||||
var next = item.get_next()
|
||||
while next:
|
||||
tree_deselect_all_but(target, next)
|
||||
next = next.get_next()
|
||||
|
||||
var prev_selected_cell
|
||||
|
||||
var button_index
|
||||
|
@ -226,6 +240,10 @@ var button_index
|
|||
func tree_item_selected():
|
||||
button_index = null
|
||||
var cell = node.get_selected()
|
||||
if cell:
|
||||
cell.select(0)
|
||||
if node.select_mode == Tree.SELECT_MULTI:
|
||||
tree_deselect_all_but(cell, node.get_root())
|
||||
if cell != prev_selected_cell:
|
||||
tree_item_render()
|
||||
prev_selected_cell = cell
|
||||
|
|
Loading…
Reference in New Issue
Block a user