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.
Parameters
Section titled “Parameters”bounds
Section titled “bounds”padding
Section titled “padding”number
limits
Section titled “limits”ZoomLimits