@mocanvas/editor · function

resizeBox

declare function resizeBox<T extends TLBaseBoxShape>(shape: T, info: ResizeInfo<T>, opts?: ResizeBoxOptions): Partial<T>

The default resize for a box-shaped shape.

Handles the three things every box shape gets wrong when it writes this itself: a negative scale (dragging a handle past the opposite edge, which should flip the box rather than give it a negative width), the position change that a flip implies, and clamping to a minimum size without letting the box drift while it is clamped.

Returns the props to merge into the shape, so a util can post-process the result: return { ...resizeBox(shape, info), props: { ...} }.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.