mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-22 03:45:56 +00:00
Move all accessibility code into Accessible class. Also, add tree-augmenting function to make an entire tree accessible.
This commit is contained in:
parent
319c1297c4
commit
2f1ad85f1d
|
@ -5,13 +5,18 @@ var Accessible = preload("accessible.gd")
|
|||
|
||||
func augment_node(node):
|
||||
if node is Control:
|
||||
node.set_focus_mode(Control.FOCUS_ALL)
|
||||
Accessible.new(node)
|
||||
|
||||
func augment_tree(node):
|
||||
augment_node(node)
|
||||
for child in node.get_children():
|
||||
augment_node(child)
|
||||
|
||||
func set_initial_screen_focus(screen):
|
||||
print("Screen ",screen)
|
||||
var focus
|
||||
var root = get_tree().root
|
||||
augment_tree(root)
|
||||
if screen == "3D":
|
||||
focus = root.find_node("ToolButton", true, false)
|
||||
print("Focus ",focus)
|
||||
|
|
|
@ -3,10 +3,10 @@ extends Object
|
|||
var node
|
||||
|
||||
func focused():
|
||||
print("Focus entered.")
|
||||
print("Focus entered.", self.node)
|
||||
|
||||
func unfocused():
|
||||
print("Unfocused")
|
||||
print("Unfocused", self.node)
|
||||
|
||||
func gui_input():
|
||||
print("GUI input.")
|
||||
|
@ -15,8 +15,9 @@ func _init(node):
|
|||
if node.is_in_group("accessible"):
|
||||
return
|
||||
node.add_to_group("accessible")
|
||||
# print(node.get_path())
|
||||
print(node.get_path())
|
||||
self.node = node
|
||||
self.node.set_focus_mode(Control.FOCUS_ALL)
|
||||
self.node.connect("focus_entered", self, "focused")
|
||||
self.node.connect("mouse_entered", self, "focused")
|
||||
self.node.connect("focus_exited", self, "unfocused")
|
||||
|
|
Loading…
Reference in New Issue
Block a user