Skip to content
Entangle UI v0.13.0

computeFitTransform

computeFitTransform(bounds, size, padding, limits): ViewportTransform

Defined in: src/components/primitives/viewport/viewportMath.ts:22

Compute a transform that fits bounds (in world coordinates) into the viewport size, with optional uniform inner padding in screen pixels.

The resulting transform preserves aspect ratio (uniform zoom on both axes) and centers the content within the viewport.

WorldRect

ViewportSize

number

ZoomLimits

ViewportTransform