Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @tool
- extends ScrollContainer
- @onready var v_box_container: VBoxContainer = $VBoxContainer
- var max_height: float = 0.0
- func _notification(what: int) -> void:
- match what:
- NOTIFICATION_SORT_CHILDREN: # children are reordered or their transforms/sizes are affected.
- custom_minimum_size.y = min(v_box_container.size.y, max_height)
- NOTIFICATION_PARENTED, NOTIFICATION_VISIBILITY_CHANGED:
- # Get the maximum possible size
- size_flags_vertical = SIZE_EXPAND_FILL
- await get_tree().process_frame
- max_height = size.y
- size_flags_vertical = SIZE_SHRINK_BEGIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement