API Reference > imodeljs-frontend > Rendering > getCenteredViewRect 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 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 core/frontend/src/ImageUtil.ts Line 295 Last Updated: 12 June, 2024