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