MapLayerEventType
MapLayerEventType =
object
Defined in: src/ui/events.ts:50
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.
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');
});
Properties
click
click:
MapLayerMouseEvent
Defined in: src/ui/events.ts:57
Fired when a pointing device (usually a mouse) is pressed and released contains a visible portion of the specified layer.
See
contextmenu
contextmenu:
MapLayerMouseEvent
Defined in: src/ui/events.ts:116
Fired when the right button of the mouse is clicked or the context menu key is pressed within visible portion of the specified layer.
dblclick
dblclick:
MapLayerMouseEvent
Defined in: src/ui/events.ts:64
Fired when a pointing device (usually a mouse) is pressed and released twice contains a visible portion of the specified layer.
Note
Under normal conditions, this event will be preceded by two click
events.
mousedown
mousedown:
MapLayerMouseEvent
Defined in: src/ui/events.ts:69
Fired when a pointing device (usually a mouse) is pressed while inside a visible portion of the specified layer.
See
mouseenter
mouseenter:
MapLayerMouseEvent
Defined in: src/ui/events.ts:92
Fired when a pointing device (usually a mouse) enters a visible portion of a specified layer from outside that layer or outside the map canvas.
See
mouseleave
mouseleave:
MapLayerMouseEvent
Defined in: src/ui/events.ts:100
Fired when a pointing device (usually a mouse) leaves a visible portion of a specified layer, or leaves the map canvas.
See
mousemove
mousemove:
MapLayerMouseEvent
Defined in: src/ui/events.ts:84
Fired when a pointing device (usually a mouse) is moved while the cursor is inside a visible portion of the specified layer. As you move the cursor across the layer, the event will fire every time the cursor changes position within that layer.
See
- Get coordinates of the mouse pointer
- Highlight features under the mouse pointer
- Display a popup on over
- Animate symbol to follow the mouse
mouseout
mouseout:
MapLayerMouseEvent
Defined in: src/ui/events.ts:112
Fired when a point device (usually a mouse) leaves the visible portion of the specified layer.
mouseover
mouseover:
MapLayerMouseEvent
Defined in: src/ui/events.ts:108
Fired when a pointing device (usually a mouse) is moved inside a visible portion of the specified layer.
See
- Get coordinates of the mouse pointer
- Highlight features under the mouse pointer
- Display a popup on hover
mouseup
mouseup:
MapLayerMouseEvent
Defined in: src/ui/events.ts:74
Fired when a pointing device (usually a mouse) is released while inside a visible portion of the specified layer.
See
touchcancel
touchcancel:
MapLayerTouchEvent
Defined in: src/ui/events.ts:131
Fired when a touchstart
event occurs within the visible portion of the specified layer.
See
touchend
touchend:
MapLayerTouchEvent
Defined in: src/ui/events.ts:126
Fired when a touchend
event occurs within the visible portion of the specified layer.
See
touchstart
touchstart:
MapLayerTouchEvent
Defined in: src/ui/events.ts:121
Fired when a touchstart
event occurs within the visible portion of the specified layer.