@joint/react
    Preparing search index...

    Type Alias TransformElementLayout

    TransformElementLayout: (
        params: TransformElementLayoutParams,
    ) => 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.

    Type Declaration

      • (params: TransformElementLayoutParams): ElementLayoutOptionalXY
      • Parameters

        • params: TransformElementLayoutParams

          The element's measurement, passed to a TransformElementLayout callback. Carries the element's current x, y, and angle together with the freshly measured width and height, plus the underlying model and cell id.

          The element's measurement, passed to a TransformElementLayout callback. Carries the element's current x, y, and angle together with the freshly measured width and height, plus the underlying model and cell id.

          • Readonlyangle: number
          • Readonlyheight: number
          • Readonlyid: ID

            Id of the cell being measured.

          • Readonlymodel: Element

            The JointJS dia.Element instance being measured.

          • Readonlywidth: number
          • Readonlyx: number
          • Readonlyy: number

        Returns ElementLayoutOptionalXY

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