Adjust camera Z dynamically with canvas updates

Hey community,

Just wondering, is there a way to change camera Z translation (or arcRotateCamera radius equivalently) dynamically based on canvas size?

For example:

I have an animated camera imported from a gltf file. I hope except for the close-up shot, the entire teapot should be always inside of canvas framing.

Otherwise, if I change the canvas width and height, the render will look like this:

You can see the left and right are cropped and out of canvas frames.

What I want is very similar to this feature:

Just a way to keep mesh always inside of frame.

Many thanks,

You could take model on how it is done in framing behavior?


Ah thats a great point. Thank you! I will look into it!!