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

    Interface PoseProjection<TPose>

    Bridges arbitrary TPose shapes into the resize hook's bounds-driven math. The hook reads bounds via getBounds, runs anchor-relative math on those bounds, then asks remapBounds to project the result back into TPose.

    remapBounds(pose, src, dst) is a single operation that subsumes both "set my own AABB to dst" (single-leaf resize) and "scale me as a leaf inside parent's src→dst rect" (group resize) — they're the same affine map. For rect-shaped poses the default geometry interprets the pose as its own bounds; for Path or polygon poses the consumer supplies a projection that knows how to read and rewrite the underlying geometry.

    interface PoseProjection<TPose> {
        getBounds(pose: TPose): ResizePose;
        getRotation?(pose: TPose): number;
        intersectsRect?(pose: TPose, rect: ResizePose): boolean;
        lerp?(a: TPose, b: TPose, t: number): TPose;
        remapBounds(pose: TPose, src: ResizePose, dst: ResizePose): TPose;
        supportsRotation?(pose: TPose): boolean;
        translate?(pose: TPose, dx: number, dy: number): TPose;
    }

    Type Parameters

    • TPose
    Index

    Methods

    • Read the pose's rotation in radians. Pivot is the AABB center (getBounds(pose) center). Default 0 when omitted — descriptor declares "this pose has no rotation." When supplied and non-zero, useResize projects the drag delta into the leaf's local frame, runs anchor math there, and translates the resulting pose so the diagonally opposite world-space corner is pinned.

      Parameters

      Returns number

    • True iff this pose shape can carry a rotation. Consulted by the rotation affordance to decide whether to render the rotate cursor / drag-band over a selection. When omitted, the kit assumes true for back-compat — descriptors whose poses lack x/y/width/height/rotation fields (e.g. polygon Paths) should return false so the affordance hides instead of exposing a non-functional rotate cursor.

      Parameters

      Returns boolean