Eliminate yield in favor of _process.

This commit is contained in:
Nolan Darilek 2019-12-27 12:46:09 -06:00
parent aea75e961e
commit d6a6609673

View File

@ -494,10 +494,7 @@ var timer
func unfocused():
print_debug("Unfocused")
position_in_children = 0
timer = weakref(node.get_tree().create_timer(1))
yield(timer.get_ref(), "timeout")
if node.is_inside_tree() and not node.get_focus_owner():
node.get_tree().root.warp_mouse(node.rect_global_position)
timer = node.get_tree().create_timer(1)
func click_focused():
if node.has_focus():
@ -626,7 +623,8 @@ func _init(node):
node.connect("item_selected", self, "tree_item_selected")
node.connect("tree_exiting", self, "queue_free", [], Object.CONNECT_DEFERRED)
func _exit_tree():
if timer != null and timer.get_ref():
timer.get_ref().emit_signal("timeout")
timer.get_ref().unreference()
func _process(delta):
if timer and timer.time_left <= 0:
if node.is_inside_tree() and not node.get_focus_owner():
node.get_tree().root.warp_mouse(node.rect_global_position)
timer = null