How to align full rect but contained within top and left anchors?

Godot Version

v4.2.2.stable.official [15073afe3]


How to align full rect but contained within top and left anchors?

I’ve tried using a hboxcontainer, vboxcontainer, margincontainer… Nothing seems to work with what I want to achieve.

If a parent has a child why can’t the child transform? :smiley:
Here is my side panel hierarchy which is stored on another scene then imported to main.

Margin container
HBoxContainer with a child VBoxContainer.

When applied to my main scene anchor left wide x is equal to 0 but still visible? Though confident I can fix this if I can solve how to contain the middle panel centre.

The top panel should be overlayed ontop of all panels aligned top wide.
Left panel should be aligned left wide, behind top panel.
Middle panel should be aligned centre left contained and aligned within top and left panels.

Picture attached for reference.

I’ve spent a while trying to find a solid “simple” solution and could not find one. This is a feature that could be added “full rect contained” or when full rect contain given child or not, unless this is a feature & I am blind and can’t see it.

I did however find 2 terrible solutions:
Either using multiple containers… or manual calculation. given the container keeps proportion this is good but still irritating as I should be able to simply anchor top & left wide & centre if full rect will be contained regardless if a child or “not”.

Multiple containers inside containers is a pretty great approach to UI, very good for dynamic sizing at least.

1 Like