• JMap.Event.Map.on.mouseEnterOnLayer

    This event is triggered when the mouse enter over a layer feature on a specific layer.

    When switching from one feature to another, this event is not called again if the features are joined or intersect. This event only works on vector layers

    IMPORTANT! : This event currently only works when a JMap layer's "base style" is displayed on the map (non-thematic), and only works well with a base Style Rule with only one condition and one Style Map Scale on JMap Cloud

    Parameters

    • listenerId: string

      Your listener id (must be unique for all map events)

    • layerId: JId

      The JMap Layer Id

    • fn: ((params) => void)

      Your listener function

    Returns void

    Example

    // When mouse is entering over layer id=2 feature(s), will display 2 messages
    // in the console
    JMap.Event.Map.on.mouseEnterOnLayer(
    "custom-map-mouse-enter",
    2,
    args => {
    console.log(
    `The mouse entered an element of layer id="${args.layerId}"`,
    args.map, args.mapEvent // mapEvent is the Maplibre event
    )
    console.log(
    `The mouse cursor is over ${args.features.length} features`,
    args.location
    )
    }
    )