Interface HoverHandlerOptions

Options for createHoverHandler.

interface HoverHandlerOptions {
    layer: string;
    onHoverTargetChange?: ((hovered: undefined | SourceQualifiedFeatureSelectionTarget) => void);
    source: string;
    sourceLayer?: string;
    stateKey?: string;
}

Properties

layer: string

Layer ID to listen for mouse events on.

onHoverTargetChange?: ((hovered: undefined | SourceQualifiedFeatureSelectionTarget) => void)

Called whenever the hovered feature changes, with the source-qualified target or undefined when the pointer leaves the layer. Mirrors SelectionHandlerOptions.onSelectionTargetsChange so a hover, like a selection, can be published without re-reading hoveredId on a timer.

source: string

Source ID to set feature state on.

sourceLayer?: string

Source layer (required for vector-tile sources).

stateKey?: string

Feature-state key to toggle.

"hover"