Get real size of GUI node

So after a bit of research the way to calculate the adjusted size of the GUI nodes is as follows:

for zoom:
zoom_factor = math.max(current_width / original_width, current_height / original_height)
size = size * zoom_factor

for stretch:
stretch_x = current_width / original_width
stretch_y = current_height / original_height
size.x = size.x * stretch_x
size.y = size.y * stretch_y

for fit:
fit_factor = math.min(current_width / original_width, current_height / original_height)
size = size * fit_factor

Of course, that’s using the default render

8 Likes