Godot Version
Godot 4.2.1 stable
Question
I’m trying to change the width of a container and make it grow from its left size, from what I undestand you achieve this by changing the custom_minimum_size and it works, but only on the editor, at runtime its inconsistent. But if the initial min size is equal to max value I possible need it stops working completly. I don’t undestand how It works at first I thought that if the size value is higher than the min_size nothing should change, but on the editor setting a low min_size resizes the container to the min_size.
Gif of the problem since the forum doesn’t display it
There you can see that if I make the starting min_size 280px shorter on the x axis It works, and then after hiding the bottom panel while the left panel is hidden too it breaks, and lastly I show how if the initial value of the min_size is 1280 the max value possible, it doesn’t work at all
This are the two functions, sorry for the trama they may cause, any feedback is welcome. I use toggle_DebugLPanel()
tweens 2 containers along the x axis and then sets the min_size of the bottom panel, at run time the editor says this is working, but the actual size stops adjusting to the min size, so I’m confused about why it works both ways, is this a bug? The other function does the same but on the y axis and it also stops updating the size according to the min_size if it is initialized as its max value.
func toggle_DebugLPanel():
if tweening_nodes.has(Debug_Info) or tweening_nodes.has(Debug_Conf):
return
var tween :Tween = create_tween()
var end_pos :float = -Debug_Conf.size.x if Debug_Conf.is_open else 0
var duration :float = 0.1
tweening_nodes.append(Debug_Info)
tweening_nodes.append(Debug_Conf)
tween.set_parallel(true)
tween.tween_property(Debug_Info, "position:x", end_pos + Debug_Conf.size.x + 4, duration)
tween.tween_property(Debug_Conf, "position:x", end_pos, duration)
tween.tween_property(Debug_BPanel, "custom_minimum_size:x", get_viewport().size.x - (Debug_Conf.size.x + 4) * int(!Debug_Conf.is_open), duration)
Debug_Conf.visible = true
Debug_Conf.is_open = !Debug_Conf.is_open
await tween.finished
Debug_Conf.visible = Debug_Conf.is_open
tweening_nodes.erase(Debug_Conf)
tweening_nodes.erase(Debug_Info)
func toggle_DebugBPanel():
if tweening_nodes.has(Debug_BPanel):
return
var tween :Tween = create_tween().set_parallel(true)
var duration :float = 0.3
var vp_size_y :int = get_viewport().size.y
var end_pos :float = vp_size_y if Debug_BPanel.is_open else vp_size_y - Debug_BPanel.size.y
var end_size :float = 0 if Debug_BPanel.is_open else vp_size_y
tweening_nodes.append(Debug_BPanel)
if Debug_BPanel.is_open:
tween.tween_property(Debug_BPanel, "custom_minimum_size:y", end_size, duration)
tween.tween_property(Debug_BPanel, "position:y", end_pos, duration).set_delay(0.13)
else:
tween.tween_property(Debug_BPanel, "position:y", end_pos, 0.2)
tween.tween_property(Debug_BPanel, "custom_minimum_size:y", end_size, 0.1).set_delay(0.2)
Debug_BPanel.is_open = !Debug_BPanel.is_open
await tween.finished
Debug_BPanel.visible = Debug_BPanel.is_open
tweening_nodes.erase(Debug_BPanel)