How to force a container to updates it's size when the size of it's children changes*
I have the following setup:
A GraphNode with a Button and a ViewportContainer. I want the Button to toggle the visibility of the ViewportContainer. I also want the GraphNode to shrink in size when the ViewportContainer is not visible.
This is how it looks when the ViewportContainer is visible:
This is how it looks when the ViewportContainer is not visible:
This is how I want it to look:
I attached a demo project:
Ideally I want to use a container that would update it's size when it's children change. I could not get the ViewportContainer to expand to fit all of the available space (using anchors, margins and the size flags) so I opted to use a min rect size y. I noticed that when I do that the GraphNode does not want to shrink below the min size of the ViewportContainer, even though the container is not visible. In code I tried:
- Set the min rect size of the ViewportContainer to 0 from the ViewportContainer script
- Set the visibility of the container to false from the ViewportContainer script
- set_anchor_and_margins to manually to make the GraphNode and ViewportContainer to update from the ViewportContainer script
- queue_sort() from the ViewportContainer script
- get_parent_control().queue_sort() from the ViewportContainer script
- emit "resized" signal from the ViewportContainer script
Does anybody know how I can achieve the effect described above?