Skip to main content
computeViewport(containerWidth, containerHeight, options?, pixelRatio?): ViewportState
Defined in: packages/common/src/viewport/compute-viewport.ts:19 Computes the viewport for a container size and a set of options.

Parameters

containerWidth

number Container width, in CSS px.

containerHeight

number Container height, in CSS px.

options?

ViewportOptions = {} Design resolution and fit mode.

pixelRatio?

number = 1 Current window.devicePixelRatio.

Returns

ViewportState

Remarks

Pure function — no DOM access. Used by core’s viewport state and reusable by any renderer that needs the same math.