Documentation
Reference
2.1.50 (current version)
collection
interactivityModel
Interfaces

MapEvent

Extends Event.

Object that describes an event that took place on the map. Names of fields that are available via the Event.get method:

  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • Coordinates of the event in global pixels from the upper-left corner of the page (also available by the name "position").
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

Constructor | Methods

Constructor

Parameters:

ParameterDefault valueDescription
originalEvent *
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Object

Data associated with the event. It should contain the "map" field referencing the map on which the event has occurred.

sourceEvent

Type: IEvent

Source event.

* Mandatory parameter/option.

Example:

// Opening a balloon at the point where the map was clicked
map.events.add('click', function (e) {
    map.balloon.open(e.get('coords'), 'Click!');
});

Methods

NameReturnsDescription
allowMapEvent()

Allows the propagation of the event to the map.

Inherited from IEvent.

callMethod(name)

Object

Calls the specified method. The operation is equivalent to searching fields via "get" and making a call that passes originalEvent as context. All arguments after the first one are passed as parameters to the method being called.

Inherited from Event.

get(name)

Object

Returns the field value from originalEvent. originalEvent always has the following fields:

  • type - String event type.
  • target - Reference to the object that generated the event.
.

Inherited from Event.

getSourceEvent()

IEvent|null

Returns source event.

Inherited from IEvent.

isDefaultPrevented()

Boolean

Checks whether the default reaction to the event is canceled in the Yandex.Maps API event system.

Inherited from Event.

isImmediatePropagationStopped()

Boolean

Checks whether event propagation is stopped in the Yandex.Maps API event system.

Inherited from Event.

isMapEventAllowed()

Boolean

Returns true if the map event is enabled.

Inherited from IEvent.

isPropagationStopped()

Boolean

Checks whether event propagation up the hierarchy of objects and collections is stopped in the Yandex.Maps API event system.

Inherited from Event.

preventDefault()

Cancels the default reaction to an event within the Yandex.Maps API event system. Calling this method does not affect propagation of the DOM source event (if there is one) through the DOM tree.

Inherited from Event.

stopImmediatePropagation()

Stops event propagation in the Yandex.Maps API event system. Calling this method does not affect propagation of the DOM source event (if there is one) through the DOM tree.

Inherited from Event.

stopPropagation()

Stops event propagation up the hierarchy of objects and collections in the Yandex.Maps API event system. Calling this method does not affect propagation of the DOM source event (if there is one) through the DOM tree.

Inherited from Event.