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

    Interface UseSelectToolOptions<TPose>

    interface UseSelectToolOptions<TPose> {
        debug?: DebugSink;
        extendClickLocked?: () => boolean;
        leafPicking?: "aabb" | "silhouette";
        move?: UseMoveOptions<TPose>;
        pickBest?: (
            worldX: number,
            worldY: number,
            alt: boolean,
            selection: readonly string[],
        ) => string | null;
        pickEvery?: (worldX: number, worldY: number) => string[];
        pickTolerance?: number;
        poseBounds?: (pose: TPose) => Bounds;
        reparentOnDrop?: "top" | "off" | "above";
    }

    Type Parameters

    • TPose
    Index

    Properties

    debug?: DebugSink

    Optional debug sink. Reserved for future overlay/affordance hitbox recording.

    extendClickLocked?: () => boolean

    When this returns true, a Shift/Meta extend-click must NOT change the node selection.

    <SceneCanvas> wires it to "a path is in anchor-edit mode", where Shift-click means "add this anchor to the anchor selection". Without the lock the same click also toggles the edited node out of the node selection, and the editAnchors dep treats that as the edit target disappearing — so multi-selecting anchors silently exited edit mode.

    Only extend-clicks are locked. A plain click still re-selects, so clicking a different node exits edit mode as usual.

    leafPicking?: "aabb" | "silhouette"

    How the default pickEvery decides a leaf node covers the pointer. Ignored when pickEvery is supplied.

    • 'aabb' (default) — the pose rect. Cheap, and the historical behavior: a click anywhere in the bounding box selects the node.
    • 'silhouette' — the pose rect as a pre-test, then the ink the painter lays down: findShapeSilhouette filled or not per the painter's ink, plus its outline widened by the stroke half-width and pickTolerance. A click inside the bounding box but outside the drawn shape misses — the concave notch of a star, the corner outside an ellipse, the blank half of a text box — while a click on the thin outline of an unfilled shape hits.

    Container nodes already consult their silhouette unconditionally (it is how their clip is derived); this extends the same test to leaves. Not the default because it changes what a click selects for every existing consumer, and a painter with no silhouette is unaffected either way — it falls back to the AABB.

    Move-action options. The move gesture is dispatcher-routed, so only behaviors is consumed here — threaded into the move binding's opts.behaviors. Other UseMoveOptions fields are accepted for API shape but not read by this tool.

    pickBest?: (
        worldX: number,
        worldY: number,
        alt: boolean,
        selection: readonly string[],
    ) => string | null

    Optional alt-aware selection-update hit returning the single id the click should act on.

    pickEvery?: (worldX: number, worldY: number) => string[]

    Return ids of all objects whose painted body covers (worldX, worldY). Order doesn't matter — the tool collapses parent/child overlap via pickTopMostHit. When omitted, defaults to a rect AABB-vs-point scan over adapter.getNodes() using poseBounds (identity by default, works for {x,y,width,height} poses). Override for tighter shapes (path / polygon hit-tests).

    pickTolerance?: number

    Grab slop around a shape's outline, in world units. Default 0.

    Only consulted under leafPicking: 'silhouette'. World units because this hook has no view; <SceneCanvas> takes a screen-pixel figure (geometry.pickTolerancePx) and divides by scale on its own pick path. Without some slop a hairline outline is an unhittable target.

    poseBounds?: (pose: TPose) => Bounds

    Project a pose to its AABB. Default: identity.

    reparentOnDrop?: "top" | "off" | "above"

    Reparent-on-drop behavior for drag-to-move. 'off' (default) preserves translate-only commits. 'top' lands the moved nodes at the top of the container under the drop point. 'above' lands them immediately above the hit sibling in z-order (falls back to 'top' semantics when the hit is itself a container). Requires the nodeAtPoint dep to be registered (sourced by <SceneCanvas>).