getCenteredViewRect Function
Determine the maximum ViewRect that can be fitted and centered in specified ViewRect given a required aspect ratio.
getCenteredViewRect(viewRect: ViewRect, aspectRatio: number = 1.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: 24 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.