MapMouseEvent
Defined in: src/ui/events.ts:488
MapMouseEvent is the event type for mouse-related map events.
Example
// The `click` event is an example of a `MapMouseEvent`.
// Set up an event listener on the map.
map.on('click', (e) => {
// The event object (e) contains information like the
// coordinates of the point on the map that was clicked.
console.log('A click event has occurred at ' + e.lngLat);
});
Extends
Implements
TrackAsiaEvent<MouseEvent>
Accessors
defaultPrevented
Get Signature
get defaultPrevented():
boolean
Defined in: src/ui/events.ts:532
true if preventDefault has been called.
Returns
boolean
Methods
preventDefault()
preventDefault():
void
Defined in: src/ui/events.ts:525
Prevents subsequent default processing of the event by the map.
Calling this method will prevent the following default map behaviors:
- On
mousedownevents, the behavior of DragPanHandler - On
mousedownevents, the behavior of DragRotateHandler - On
mousedownevents, the behavior of BoxZoomHandler - On
dblclickevents, the behavior of DoubleClickZoomHandler
Returns
void
Properties
lngLat
lngLat:
LngLat
Defined in: src/ui/events.ts:512
The geographic location on the map of the mouse cursor.
originalEvent
originalEvent:
MouseEvent
Defined in: src/ui/events.ts:502
The DOM event which caused the map event.
Implementation of
TrackAsiaEvent.originalEvent
point
point:
Point
Defined in: src/ui/events.ts:507
The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
target
target:
Map
Defined in: src/ui/events.ts:497
The Map object that fired the event.
Implementation of
TrackAsiaEvent.target
type
type:
"click"|"contextmenu"|"dblclick"|"mousedown"|"mouseenter"|"mouseleave"|"mousemove"|"mouseout"|"mouseover"|"mouseup"
Defined in: src/ui/events.ts:492
The event type
Implementation of
TrackAsiaEvent.type
Overrides
Event.type