event.Mapper
Extends IEventTrigger.
Event mapper. Allows managing propagation of events along the hierarchy of event managers.
Constructor
event.Mapper(targetEventManager, mappingTable)
Parameters:
Parameter |
Default value |
Description |
ā |
Type: IEventManager The event manger that the mapper propagates initiated events to. |
|
ā |
Type: Object Table of mapping rules. A hash where the keys are types of events and the values are the corresponding mapping functions, or Boolean values. A mapping function for a specific type of event receives an event instance that was initiated on the mapper, and must return the event instance for propagating further along the hierarchy, or null if propagation must be prohibited. The boolean values are interpreted as follows:
|
* Mandatory parameter/option.
Example:
// Creating and setting up the event mapper that will transform the "click" event in the root
// geo object collection into a "geoobjectclick" event on the map itself.
var mapper = new ymaps.event.Mapper(myMap.events, {
"*": false,
"click": function (event) {
return new ymaps.Event({
type: "geoobjectclick",
target: map,
originalTarget: event.get("target")
}, event);
}
});
myMap.geoObjects.events.setParent(mapper);
Methods
Name |
Returns |
Description |
fire(type[, eventObject]) |
Triggers an event. Inherited from IEventTrigger. |
Mandatory parameter/option.