Skip to content

Commit

Permalink
fix(ExpandableCard): reset expansion where element visibility is lost
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowApex committed May 18, 2024
1 parent 4e014b5 commit 6e5da4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/ui/card_ui/quick_bar/qb_card.gd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ func _ready() -> void:
# Do nothing if running in the editor
if Engine.is_editor_hint():
return


# Auto-close when visibility is lost
var on_visibility_changed := func():
var grower := get_node("GrowerEffect") as GrowerEffect
grower.shrink()
is_toggled = false
hidden.connect(on_visibility_changed)

# Resize any children that are Control nodes
for child in content_container.get_children():
# If the node is a control, resize it based on its children
Expand Down
7 changes: 7 additions & 0 deletions core/ui/components/expandable_card.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ func _ready() -> void:
# Do nothing if running in the editor
if Engine.is_editor_hint():
return

# Auto-close when visibility is lost
var on_visibility_changed := func():
var grower := get_node("GrowerEffect") as GrowerEffect
grower.shrink()
is_toggled = false
hidden.connect(on_visibility_changed)

# Resize any children that are Control nodes
for child in content_container.get_children():
Expand Down

0 comments on commit 6e5da4d

Please sign in to comment.