getCenteredViewRect Function

Determine the maximum ViewRect that can be fitted and centered in specified ViewRect given a required aspect ratio.

getCenteredViewRect(viewRect: ViewRect, aspectRatio: number1.4): ViewRect

@returns A ViewRect centered in the input rectangle.

Parameter Type Description
viewRect ViewRect The rectangle in which the returned rectangle is to be centered and fitted.
aspectRatio number Ratio of width to height.

Returns - ViewRect

A ViewRect centered in the input rectangle.

Defined in

Last Updated: 14 November, 2024