Skip to main content
Version: 4.3

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

ParameterType
paramsTransformElementLayoutParams

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,
});

See

TransformElementLayoutParams

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub