fitSize()
Fit a size within a maximum width while preserving aspect ratio.
Import
Section titled “Import”import { fitSize } from "@graphrefly/ts/solutions/reactive-layout";Signature
Section titled “Signature”function fitSize( size: Size, maxWidth: number,): SizeParameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
size | Size | Input size. |
maxWidth | number | Maximum width constraint. |
Returns
Section titled “Returns”The fitted size.
Example
Section titled “Example”fitSize({ width: 200, height: 100 }, 50);Source
Section titled “Source”packages/ts/src/solutions/reactive-layout/utils.ts