mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-09 23: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
|
position_in_children = 0
|
||||||
timer = node.get_tree().create_timer(1)
|
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):
|
func gui_input(event):
|
||||||
if event is InputEventKey and Input.is_action_just_pressed("ui_accept") and event.control and event.alt:
|
if event is InputEventKey and Input.is_action_just_pressed("ui_accept") and event.control and event.alt:
|
||||||
TTS.speak("click", false)
|
TTS.speak("click", false)
|
||||||
|
@ -592,7 +599,9 @@ func _init(node):
|
||||||
if is_focusable(node):
|
if is_focusable(node):
|
||||||
node.set_focus_mode(Control.FOCUS_ALL)
|
node.set_focus_mode(Control.FOCUS_ALL)
|
||||||
node.connect("focus_entered", self, "focused")
|
node.connect("focus_entered", self, "focused")
|
||||||
|
node.connect("mouse_entered", self, "click_focused")
|
||||||
node.connect("focus_exited", self, "unfocused")
|
node.connect("focus_exited", self, "unfocused")
|
||||||
|
node.connect("mouse_exited", self, "unfocused")
|
||||||
node.connect("gui_input", self, "gui_input")
|
node.connect("gui_input", self, "gui_input")
|
||||||
if node is CheckBox:
|
if node is CheckBox:
|
||||||
node.connect("toggled", self, "checkbox_toggled")
|
node.connect("toggled", self, "checkbox_toggled")
|
||||||
|
|
|
@ -24,6 +24,9 @@ var focus_restore_timer
|
||||||
func focused(node):
|
func focused(node):
|
||||||
focus_restore_timer = null
|
focus_restore_timer = null
|
||||||
|
|
||||||
|
func click_focused(node):
|
||||||
|
pass
|
||||||
|
|
||||||
func unfocused(node):
|
func unfocused(node):
|
||||||
focus_restore_timer = get_tree().create_timer(0.2)
|
focus_restore_timer = get_tree().create_timer(0.2)
|
||||||
|
|
||||||
|
@ -33,8 +36,12 @@ func augment_node(node):
|
||||||
accessibles.append(accessible)
|
accessibles.append(accessible)
|
||||||
if not node.is_connected("focus_entered", self, "focused"):
|
if not node.is_connected("focus_entered", self, "focused"):
|
||||||
node.connect("focus_entered", self, "focused", [node])
|
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"):
|
if not node.is_connected("focus_exited", self, "unfocused"):
|
||||||
node.connect("focus_exited", self, "unfocused", [node])
|
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):
|
func augment_tree(node):
|
||||||
if node is Accessible:
|
if node is Accessible:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user