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

    Interface NodeShapeEntry<TData, TPose>

    interface NodeShapeEntry<TData = unknown, TPose = unknown> {
        id: string;
        ink?(node: SceneNode<TData, string, TPose>, pose: TPose): NodeInk | null;
        matches(node: SceneNode<TData, string, TPose>): boolean;
        paint(
            node: SceneNode<TData, string, TPose>,
            pose: TPose,
            ctx?: NodePaintCtx,
        ): DrawCommand[];
        silhouette?(
            node: SceneNode<TData, string, TPose>,
            pose: TPose,
        ): Path | null;
    }

    Type Parameters

    • TData = unknown
    • TPose = unknown
    Index

    Properties

    Methods

    Properties

    id: string

    Stable identifier — used for unregistration and debugging. Pick something descriptive: 'kit:text', 'app:image', etc.

    Methods

    • Optional: how the silhouette is inked — whether the interior is filled, and how wide the outline is. Read by picking, so that an unfilled shape is grabbable by its outline rather than by its empty middle.

      This is declared separately from paint rather than read back off the emitted draw commands because picking runs on every pointer move, and paint is allowed to be expensive (kit:text lays out glyphs). Keep it to cheap field reads.

      Painters that leave it undefined are treated as { filled: true, strokeWidth: 0 } — the pre-ink behavior, where the whole silhouette interior is grabbable and the outline adds nothing.

      Parameters

      Returns NodeInk | null

    • Emits the draw commands for the node's primary visual. ctx is an optional per-call paint context (see NodePaintCtx); painters that don't need it can keep a two-argument signature.

      The returned array belongs to the painter. Callers must treat it as immutable and copy before appending — a painter is free to memoize its command list (kit:shape and kit:path do), and an in-place push would grow that list on every frame. defaultDrawOne copies before adding its label overlay for exactly this reason.

      Parameters

      Returns DrawCommand[]

    • Optional: derive the node's silhouette path from its pose. Used by clipping (when the container has no explicit clipFromPose), by non-rect hit-testing, by lasso/area-select, and by SVG export. Painters whose visual has no meaningful closed silhouette (e.g. text) leave this undefined.

      Parameters

      Returns Path | null