Type alias MapLayerEventType

MapLayerEventType: {
    click: MapLayerMouseEvent;
    contextmenu: MapLayerMouseEvent;
    dblclick: MapLayerMouseEvent;
    mousedown: MapLayerMouseEvent;
    mouseenter: MapLayerMouseEvent;
    mouseleave: MapLayerMouseEvent;
    mousemove: MapLayerMouseEvent;
    mouseout: MapLayerMouseEvent;
    mouseover: MapLayerMouseEvent;
    mouseup: MapLayerMouseEvent;
    touchcancel: MapLayerTouchEvent;
    touchend: MapLayerTouchEvent;
    touchstart: MapLayerTouchEvent;
}

MapLayerEventType - a mapping between the event name and the event. Note: These events are compatible with the optional layerId parameter. If layerId is included as the second argument in Map#on, the event listener will fire only when the event action contains a visible portion of the specified layer. The following example can be used for all the events.

Type declaration

Example

// Initialize the map
let map = new Map({ // map options });
// Set an event listener for a specific layer
map.on('the-event-name', 'poi-label', (e) => {
console.log('An event has occurred on a visible portion of the poi-label layer');
});