|Attention||Topic was automatically imported from the old Question2Answer platform.|
i have a scene with a texture rect (whose texture is loaded time to time from pictures in a folder) and an “Expand” button.
I want it to have a pretty simple beahaviour:
- if the picture dimension is bigger than the screen, i want it to scale it down to fit the screen
- if the picture dimension is smaller and expand is pressed, i want the texture to be scaled up to fill the screen dimension
- If the picture dimension is smaller and not expanded, the texture remain had the same dimension of the screen
4.I want the picture to always remain in the middle of the screen and to keep its aspect ratio.
Is there a way to do it with control nodes? ideally, the perfect code would control the
stretch_mode of the texture rect properties only.
I really cannot find a way to make it work easily