Advertisement
nanathecarrot

Untitled

Jul 6th, 2025
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @tool
  2. extends ScrollContainer
  3.  
  4. @onready var v_box_container: VBoxContainer = $VBoxContainer
  5. var max_height: float = 0.0
  6.  
  7.  
  8. func _notification(what: int) -> void:
  9.     match what:
  10.         NOTIFICATION_SORT_CHILDREN: # children are reordered or their transforms/sizes are affected.
  11.             custom_minimum_size.y = min(v_box_container.size.y, max_height)
  12.  
  13.         NOTIFICATION_PARENTED, NOTIFICATION_VISIBILITY_CHANGED:
  14.             # Get the maximum possible size
  15.             size_flags_vertical = SIZE_EXPAND_FILL
  16.             await get_tree().process_frame
  17.             max_height = size.y
  18.             size_flags_vertical = SIZE_SHRINK_BEGIN
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement