This is the documentation of version 1.0.0-rc.4. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias CustomLayerEventsOptions<HIT>

    How a custom layer's objects join the map's user events.

    type CustomLayerEventsOptions<HIT extends CustomLayerHit = CustomLayerHit> = {
        events?: EventHandlerConfig;
        hitTest: CustomLayerHitTest<HIT>;
        setState?: (id: HIT["id"], state: EventState | undefined) => void;
    }

    Type Parameters

    Index

    The hover cursor and grace period over the layer's objects, as a module's events config sets them.

    Tells which of the layer's objects lie under the pointer, so the layer's events fire on them.

    setState?: (id: HIT["id"], state: EventState | undefined) => void

    Draws an object's event state, which the SDK has no feature state to keep in: 'hover' when the pointer arrives on it, 'long-hover' once it rests there, 'click' or 'contextmenu' when clicked, and undefined once the state is gone.

    The states follow the rules of a module's features: a click outranks a hover, a new click or hover takes the same kind of state off the layer's other objects, and a left object stays 'recently-hovered' for the hover grace period.