Skip to content

Commit

Permalink
Merge pull request #45 from lingthing/godot-3
Browse files Browse the repository at this point in the history
Fix _on_focus_changed method errors in godot-3 branch
  • Loading branch information
SpyrexDE authored Feb 22, 2024
2 parents d892b3e + 9de92d5 commit 458897f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions addons/SmoothScroll/SmoothScrollContainer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func _gui_input(event: InputEvent) -> void:
# Scroll to new focused element
func _on_focus_changed(control: Control) -> void:
var is_child := false
if content_node.is_ancestor_of(control):
if content_node.is_a_parent_of(control):
is_child = true
if not is_child:
return
Expand All @@ -248,9 +248,9 @@ func _on_focus_changed(control: Control) -> void:

var focus_size_x = control.rect_size.x
var focus_size_y = control.rect_size.y
var focus_left = control.global_position.x - self.global_position.x
var focus_left = control.rect_global_position.x - self.rect_global_position.x
var focus_right = focus_left + focus_size_x
var focus_top = control.global_position.y - self.global_position.y
var focus_top = control.rect_global_position.y - self.rect_global_position.y
var focus_bottom = focus_top + focus_size_y

if focus_top < 0.0:
Expand Down

0 comments on commit 458897f

Please sign in to comment.