getSizeOfBoxKeepingRatioGivenContainer

This function is used to calculate the size of a Box (our camera preview) after scaling it down to be fitted in a Container while preserving the aspect ration of the Box

To fit the Box in the Container, we consider the aspect ratio (AR) cases:

  1. Box AR is wider than Container:

    1. Set Box width equal to Container width

    2. Scale down height of Box and keep Box AR

  2. Box AR is taller than Container:

    1. Set Box height equal to Container height

    2. Scale down width of Box and keep Box AR