How to properly scale the interface as desired by the user.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By thisischico

I want to create the ability to customize the size of the interface by the user like in minecraft. To do this, I decided to use the scaling of the main interface nodes, but ran into the following problem: anchors stretch the main size of the nodes, and only then apply the scaling. Because of this feature, the interface nodes extend beyond the window.

How to properly implement custom interface scaling?

:bust_in_silhouette: Reply From: IronStudios

If I understood you correctly, you’re trying to scale a UI node but it’s scaling from the wrong position.
I don’t know if this solves your problem, but I put together a test and it worked for me by changing the Pivot offset to the bottom center of the node, if it’s on the left of the screen set it to the left center.

godot ui scaling

enter image description here
enter image description here

https://imgur.com/a/CTFYyyC
Imgur: The magic of the Internet

Unfortunately, that’s not what I need. I attached screenshots to make my question clearer. Stretching with anchors does not take into account the scaling of the node, which makes it go beyond the edge of the window. The node has a scale of 2, the more I enlarge the panel that way, the more it will extend beyond the edge of the window, and I want it to obey the anchor stretch while maintaining its scale.

thisischico | 2022-01-12 21:44

:bust_in_silhouette: Reply From: thisischico