weasel API - v0.8.0
    Preparing search index...

    Interface UseInsertOptions<TPose, TNode>

    interface UseInsertOptions<TPose, TNode extends { id: string } = { id: string }> {
        applyOps?: (ops: Op[], label: string) => void;
        behaviors?: InsertBehavior<TPose>[];
        clickOnly?: boolean;
        insertLabel?: string;
        minBounds?: { height: number; width: number };
        onGestureEnd?: (committed: boolean) => void;
        onGestureStart?: () => void;
        pointInsert?: (point: { x: number; y: number }) => TNode | null;
        posefromBounds?: (bounds: ResizePose) => TPose;
        snapPoint?: (p: { x: number; y: number }) => { x: number; y: number };
        transient?: boolean;
    }

    Type Parameters

    • TPose
    • TNode extends { id: string } = { id: string }
    Index

    Properties

    applyOps?: (ops: Op[], label: string) => void

    Override for op dispatch on commit. When set, this is called instead of dispatchApplyBatch(adapter, ...). Tool hooks that synthesize an adapter but want commits to route through the active tool ctx's applyOps (for history integration) supply a function that reads from a ref captured on handler entry. Read fresh on every commit, so a ref-reader works without retriggering memos.

    behaviors?: InsertBehavior<TPose>[]
    clickOnly?: boolean

    Drag-disabled mode. When true, every release routes to pointInsert(start) regardless of bounds — commitInsert is never called. Used by tool hooks that wire only pointer.onClick (no marquee).

    insertLabel?: string
    minBounds?: { height: number; width: number }

    Strictly-greater-than thresholds; bounds with width <= or height <= abort. Default { width: 0, height: 0 }.

    onGestureEnd?: (committed: boolean) => void
    onGestureStart?: () => void
    pointInsert?: (point: { x: number; y: number }) => TNode | null

    Click / sub-threshold-drag fallback. When provided, a release whose bounds fall <= minBounds calls pointInsert(start) instead of aborting. Returning null aborts. The created object is dispatched as an InsertOp under the same insertLabel.

    posefromBounds?: (bounds: ResizePose) => TPose

    Construct the in-flight pose from the drag bounds. Defaults to the identity cast (treat bounds as TPose). Override for non-rect TPose (e.g. (b) => rectPath(b) or a polygon factory).

    snapPoint?: (p: { x: number; y: number }) => { x: number; y: number }

    Optional: snap world-space points to the active grid (or any other snap target). Applied to every coord the gesture ingests, so both the live marquee overlay and the committed bounds track the snapped values. When omitted, behavior is identical to today (identity passthrough).

    transient?: boolean

    Reserved; insert is never transient in practice. Ignored.