From 10e457bf26c600ce3b3e2d40b21839bc2804381e Mon Sep 17 00:00:00 2001 From: Variable <77773850+Variable-ind@users.noreply.github.com> Date: Fri, 20 Sep 2024 20:45:06 +0500 Subject: [PATCH] =?UTF-8?q?=20Set=20dynamics=20dialog=20to=20correct=20siz?= =?UTF-8?q?e=20after=20something=20is=20made=20visible=20=E2=80=A6=20(#110?= =?UTF-8?q?4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Set dynamics dialog to correct size after something is made visible or hidden * use a separate function instead of lambdha --- src/UI/GlobalToolOptions/DynamicsPanel.gd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/UI/GlobalToolOptions/DynamicsPanel.gd b/src/UI/GlobalToolOptions/DynamicsPanel.gd index e798298d2..c8738ae3a 100644 --- a/src/UI/GlobalToolOptions/DynamicsPanel.gd +++ b/src/UI/GlobalToolOptions/DynamicsPanel.gd @@ -29,6 +29,15 @@ 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(_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: