2D Orthographic camera movement clamp in any orthographic size

Hello guys.I have a problem, which i currently can’t figure out how to solve. I am trying to calculate a clamp value for world coordinates which have to respect any camera orthographic size.I bought an image file just to illustrate it better.


Picture 1 and 2 are my current results which i get from the camera extents.Picture 3 and 4 illustrates the problem i need to solve.So for example if i lower a little bit the camera orthographic size, if the clamp values stay the same, there is a space between the camera view and the world map which can’t be covered by the clamped values in this current condition.So is there any way i can calculate the clamped positions in every camera orthographic size?Can somebody help me out?

Orthographic.size is 1/2 of the world height seen by the camera. So in order to generate the values:

   var minY = Camera.main.transform.position.y - Camera.main.orthographicSize;
   var maxY = Camera.main.transform.position.y + Camera.main.orthographicSize;