Function: ComputeCanvasOrthoSize()
ts
function ComputeCanvasOrthoSize(
referenceWidth,
referenceHeight,
scaleMode,
viewportWidth,
viewportHeight
): number;Orthographic half-height that maps a canvas reference rect into a viewportWidth × viewportHeight viewport under a scale mode. The single source for the engine's cameras, WidgetSystem's 'window' anchoring and editor tooling — they must agree or anchors drift from what's drawn. Fit — letterbox; both axes fit, bars on the shorter one. Fill — crop; the viewport is fully covered, overflow is clipped. FitWidth — width matches exactly; height follows the viewport aspect. FitHeight — height matches exactly; width follows the viewport aspect. Stretch — a single ortho can't scale axes independently, so it falls back to Fit.
Parameters
| Parameter | Type |
|---|---|
referenceWidth | number |
referenceHeight | number |
scaleMode | CanvasScaleMode |
viewportWidth | number |
viewportHeight | number |
Returns
number