supervision-js
    Preparing search index...

    Interface MediaInteractionOptions

    The renderer supplies viewportScale from its own viewport.

    interface MediaInteractionOptions {
        preferTopmost?: boolean;
        maskOrder?: "detection";
        padding?: number;
        polylinePadding?: number;
        keypointPadding?: number;
        edgePadding?: number;
        maskMediaDimensions?: { width: number; height: number };
        includeLocked?: boolean;
        includeMasks?: boolean;
        filter?: (detection: Detection, detectionIndex: number) => boolean;
        mode?: MediaInteractionMode;
        onPointerPress?: (
            press: {
                input: AnnotationPointerInput;
                pick: DetectionPickResult | null;
                selectedHandle:
                    | { pick: DetectionPickResult; handle: AnnotationHandleDefinition }
                    | null;
            },
        ) => "handled"
        | "continue";
        onHover?: (pick: DetectionPickResult | null) => void;
        onSelect?: (pick: DetectionPickResult | null) => void;
        multiSelect?: boolean;
        marqueeSelectionMode?: "intersects" | "contained";
        onSelectionChange?: (picks: readonly DetectionPickResult[]) => void;
        onMarqueeChange?: (
            rect: { x: number; y: number; width: number; height: number } | null,
        ) => void;
    }

    Hierarchy

    Index
    preferTopmost?: boolean

    Pick editable geometry by zIndex, then frame order, rather than area. Rects accompanying masks or paths are bounds, not independent box targets; mask fills stay below vector geometry unless maskOrder is "detection". Defaults to false.

    maskOrder?: "detection"

    Include masks in detection order when preferTopmost is enabled.

    padding?: number
    polylinePadding?: number
    keypointPadding?: number
    edgePadding?: number
    maskMediaDimensions?: { width: number; height: number }

    Media dimensions used to map media-space points into mask raster space.

    includeLocked?: boolean
    includeMasks?: boolean
    filter?: (detection: Detection, detectionIndex: number) => boolean
    onPointerPress?: (
        press: {
            input: AnnotationPointerInput;
            pick: DetectionPickResult | null;
            selectedHandle:
                | { pick: DetectionPickResult; handle: AnnotationHandleDefinition }
                | null;
        },
    ) => "handled"
    | "continue"

    Runs before default selection, editing, or marquee handling, including empty presses and repeated hits. Return "handled" to skip those defaults and the press's subsequent tap, or "continue" to keep them. Hosts own any ongoing gesture and should let its release or cancellation reach the renderer. The browser may report coordinates outside media; there, "continue" permits only selected-handle editing with an editing engine. Returning "continue" must leave selection and editing state unchanged: defaults use the snapshot resolved before this callback. Return "handled" when the host changes that state.

    onHover?: (pick: DetectionPickResult | null) => void
    onSelect?: (pick: DetectionPickResult | null) => void

    Reports selection identity changes. A stable, frame-unique detection id may keep rendering as selected across later frames without re-emitting this callback. The pick is the immutable frame snapshot where the selection event occurred; use the detection id with the active frame when current geometry is required.

    multiSelect?: boolean
    marqueeSelectionMode?: "intersects" | "contained"

    Select intersecting bounds by default, or require full containment.

    onSelectionChange?: (picks: readonly DetectionPickResult[]) => void

    Reports selection membership changes, not per-frame geometry updates for stable detection ids. Each pick is the snapshot that produced that membership event.

    onMarqueeChange?: (
        rect: { x: number; y: number; width: number; height: number } | null,
    ) => void