Fit control node ui to subviewport size

Godot Version

4.1.1

Question

I’ve got some ui set up with a few control nodes:

I want to show it on a viewport texture, but can’t get the texture to scale correctly to the viewport size. If I make the viewport size match the viewport size from project settings it is all visible but squished horizontally:

Trying to set the size to half cuts the image off, instead of the control node automatically filling the available viewport:

What node setup do I need to make control nodes fill the subviewport size without stretching or cropping?

Got it! In my 3d scene I set the subviewport size:

And selected the child ui node under the subviewport, setting it to full rect (the size was automatic):

And now it works:

So you have to manually set the control node’s size to the same as the subviewport’s size.