keepAspectRatio()

Maximizes the dimensions while keeping the same aspect ratio.

This function is valid in v2.0.0 to v2.24.3. This function has been downloaded 60 times.

Parameters

{number} width
The base width.
{number} height
The base height.
{number} tagetWidth
The target width.
{number} targetHeight
The target height.
{boolean=} opt_maximize Optional, Default:false
If false-ish, the minimum dimensions will be found where at least one of the dimensions matches the corresponding target dimension. If true-ish, the maximum dimensions will be found where at least one of the dimensions matches the corresponding target dimension.

Returns

{Object}
Object containing the minimum or maximum calculated width and height while keeping the same aspect ratio provided. Eg. { height: 400, width: 320 }.