mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-12-22 07:35:56 +00:00
Revert "Apparently, focused
is triggered on mouse_enter
as well, so this code isn't needed."
Necessary for next commit, which selectively ignores mouse events and needs this code for explore-by-touch.
This reverts commit dc6186c583
.
This commit is contained in:
parent
dc6186c583
commit
fbbbb1e06e
|
@ -502,6 +502,13 @@ func unfocused():
|
|||
position_in_children = 0
|
||||
timer = node.get_tree().create_timer(1)
|
||||
|
||||
func click_focused():
|
||||
if node.has_focus():
|
||||
return
|
||||
if node.focus_mode == Control.FOCUS_ALL:
|
||||
print_debug("Grabbing focus: %s" % node)
|
||||
node.grab_focus()
|
||||
|
||||
func gui_input(event):
|
||||
if event is InputEventKey and Input.is_action_just_pressed("ui_accept") and event.control and event.alt:
|
||||
TTS.speak("click", false)
|
||||
|
@ -592,7 +599,9 @@ func _init(node):
|
|||
if is_focusable(node):
|
||||
node.set_focus_mode(Control.FOCUS_ALL)
|
||||
node.connect("focus_entered", self, "focused")
|
||||
node.connect("mouse_entered", self, "click_focused")
|
||||
node.connect("focus_exited", self, "unfocused")
|
||||
node.connect("mouse_exited", self, "unfocused")
|
||||
node.connect("gui_input", self, "gui_input")
|
||||
if node is CheckBox:
|
||||
node.connect("toggled", self, "checkbox_toggled")
|
||||
|
|
|
@ -24,6 +24,9 @@ var focus_restore_timer
|
|||
func focused(node):
|
||||
focus_restore_timer = null
|
||||
|
||||
func click_focused(node):
|
||||
pass
|
||||
|
||||
func unfocused(node):
|
||||
focus_restore_timer = get_tree().create_timer(0.2)
|
||||
|
||||
|
@ -33,8 +36,12 @@ func augment_node(node):
|
|||
accessibles.append(accessible)
|
||||
if not node.is_connected("focus_entered", self, "focused"):
|
||||
node.connect("focus_entered", self, "focused", [node])
|
||||
if not node.is_connected("mouse_entered", self, "click_focused"):
|
||||
node.connect("mouse_entered", self, "click_focused", [node])
|
||||
if not node.is_connected("focus_exited", self, "unfocused"):
|
||||
node.connect("focus_exited", self, "unfocused", [node])
|
||||
if not node.is_connected("mouse_exited", self, "unfocused"):
|
||||
node.connect("mouse_exited", self, "unfocused", [node])
|
||||
|
||||
func augment_tree(node):
|
||||
if node is Accessible:
|
||||
|
|
Loading…
Reference in New Issue
Block a user