A 'Keep Aspect' option for Size Flags #4039
Powerbyte7
started this conversation in
GUI
Replies: 1 comment 3 replies
-
Did you look at the AspectRatioContainer node which was added in Godot 3.4? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you want to have one or more nodes that expand dynamically within a container, there's no built-in option to have the margins respect an aspect ratio.
Here's a practical example of the behavior I'm looking for using a script. The VBox and the icon both maintain their aspect ratios.
UI-demo.mp4
The way I'm achieving this behavior right now is to disable the icon's size flags and to update its minimal size instead for each frame according to the container size.
I think it'd be a lot nicer to be able to set an aspect ratio of '3.0' in the VBox size flags and an aspect ratio of '1.0' in the TextureRect size flags, especially when more nodes are present in the container.
I haven't made a full proposal yet, because I'm curious to know if anyone knows a better way to do this.
Beta Was this translation helpful? Give feedback.
All reactions