Methods
Static calculateAspectRatioFit
- calculateAspectRatioFit(srcWidth: any, srcHeight: any, maxWidth: any, maxHeight: any): object
-
Parameters
-
srcWidth: any
-
srcHeight: any
-
maxWidth: any
-
maxHeight: any
Returns object
{ width, heigth }
-
height: number
-
width: number
Conserve aspect ratio of the orignal region. Useful when shrinking/enlarging images to fit into a certain area.
In most cases this is not needed as the object-fit:contain CSS will obtain the desired result.