TransformElementLayout
type TransformElementLayout = (params) => ElementLayoutOptionalXY;
Adjusts a measured element layout before it is written to the graph. Receives
the element's current geometry plus its newly measured size, and returns the
width/height (and optionally x/y) to apply — use it to clamp sizes,
snap to a grid, or reposition while auto-sizing. Pass it via the transform
option of useMeasureElement.
Parameters
| Parameter | Type |
|---|---|
params | TransformElementLayoutParams |
Returns
ElementLayoutOptionalXY
Example
import type { TransformElementLayout } from '@joint/react';
// Never let a measured element shrink below 80px wide.
const transform: TransformElementLayout = ({ width, height }) => ({
width: Math.max(width, 80),
height,
});