From 464939cbfd56945af1bd140d3bf9799383d9b7eb Mon Sep 17 00:00:00 2001 From: Variable <77773850+Variable-ind@users.noreply.github.com> Date: Sat, 14 Sep 2024 14:16:32 +0500 Subject: [PATCH 1/2] Set dynamics dialog to correct size after something is made visible or hidden --- src/UI/GlobalToolOptions/DynamicsPanel.gd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/UI/GlobalToolOptions/DynamicsPanel.gd b/src/UI/GlobalToolOptions/DynamicsPanel.gd index e798298d2f3..3e2f3b1ce3c 100644 --- a/src/UI/GlobalToolOptions/DynamicsPanel.gd +++ b/src/UI/GlobalToolOptions/DynamicsPanel.gd @@ -29,6 +29,13 @@ func _ready() -> void: size_velocity_button.toggled.connect( _on_dynamics_toggled.bind(size_velocity_button, SIZE, Tools.Dynamics.VELOCITY) ) + for child: Control in $VBoxContainer.get_children(): + ## Resets the y-size to an appropriate value + child.visibility_changed.connect(func (): + await get_tree().process_frame + set_size(Vector2i(size.x, 0)) + set_size(Vector2i(size.x, size.y + 10)) + ) func _input(event: InputEvent) -> void: From 94102bde7055c199dd0c47ba6082d482c2cbab1a Mon Sep 17 00:00:00 2001 From: Variable Date: Wed, 18 Sep 2024 19:06:13 +0500 Subject: [PATCH 2/2] use a separate function instead of lambdha --- src/UI/GlobalToolOptions/DynamicsPanel.gd | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/UI/GlobalToolOptions/DynamicsPanel.gd b/src/UI/GlobalToolOptions/DynamicsPanel.gd index 3e2f3b1ce3c..c8738ae3a24 100644 --- a/src/UI/GlobalToolOptions/DynamicsPanel.gd +++ b/src/UI/GlobalToolOptions/DynamicsPanel.gd @@ -31,11 +31,13 @@ func _ready() -> void: ) for child: Control in $VBoxContainer.get_children(): ## Resets the y-size to an appropriate value - child.visibility_changed.connect(func (): - await get_tree().process_frame - set_size(Vector2i(size.x, 0)) - set_size(Vector2i(size.x, size.y + 10)) - ) + child.visibility_changed.connect(_recalculate_size) + + +func _recalculate_size(): + await get_tree().process_frame + set_size(Vector2i(size.x, 0)) + set_size(Vector2i(size.x, size.y + 10)) func _input(event: InputEvent) -> void: