hotspot.Layer
Extends IChildOnMap, ICustomizable.
Hotspot layer.
Constructor | Fields | Events | Methods
Constructor
hotspot.Layer(objectSource[, options])
Creates the hotspot layer. Each individual area on the layer consists of an object - hotspot.layer.Object.
Parameters:
Parameter |
Default value |
Description |
— |
Type: IHotspotObjectSource Source of objects for the layer. |
|
— |
Type: Object Layer options. Options for balloons Balloon and hints Hint on the hotspot layer must be indicated with the "balloon" and "hint" prefixes. |
|
'pointer' |
Type: String Type of cursor. |
|
false |
Type: Boolean Option that prevents changing the cursor when pointing at an object on the layer. By default, cursors change. |
|
true |
Type: Boolean Flag showing whether the layer has balloons. If the flag value is "false", the ".balloon" field will not be created for the layer. |
|
true |
Type: Boolean Flag showing whether the layer has hints. If the flag value is "false", the ".hint" field will not be created for the layer. |
|
'default#layer' |
Type: String Interactivity model for the layer. Available keys and their values are listed in the description of interactivityModel.storage. |
|
true |
Type: Boolean Option that prevents opening the balloon when clicking on a hotspot object. By default, opening the balloon is allowed. |
|
false |
Type: String Open the balloon with empty contents. |
|
false |
Type: String Show a popup hint with empty contents. |
|
true |
Type: Boolean Option that prevents showing the hint when pointing at a hotspot object. By default, showing hints is allowed. |
|
'events' |
Type: IEventPane Container with map elements that events are listened on. |
|
— |
Type: Number The zIndex value of the layer. When searching for the active object on a single layer and the cursor falls on two objects simultaneously, the object with the larger zIndex value is selected. From that point on - for example, when determining which layer's shape takes priority - the zIndex value of the layer is used. Please note that the zIndex of the layer will determine the relative position of the objects on the layer, as well as single objects added to particular map panes. For example, if you want to place hotspot objects over the area objects, you should set zIndex=201 for the hotspot layer. See map.pane.Manager. |
* Mandatory parameter/option.
Example:
// Creating the source for hotspot data. We aren't setting the key value,
// so the name of the handler function (padding jsonp in the request) is generated automatically.
var objectSource = new ymaps.hotspot.ObjectSource('tiles/?%c'),
hotspotLayer = new ymaps.hotspot.Layer(objectSource, {
zIndex: 100,
// Allowing the balloon to be opened without content.
showEmptyBalloon: true
});
Fields
Name |
Type |
Description |
Hotspot layer balloon. |
||
Event manager. Inherited from IEventEmitter. |
||
Hotspot layer hint. |
||
Options manager. Inherited from ICustomizable. |
Events
Name |
Description |
Layer added to the map. |
|
Closing the balloon. Instance of the Event class. |
|
Opening the balloon on the hotspot layer. Instance of the Event class. |
|
Single left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
|
|
Calls the element's context menu. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
|
|
Double left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
|
|
Closing the hint. Instance of the Event class. |
|
Opening the hint on the hotspot layer. Instance of the Event class. |
|
Pressing the mouse button over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
|
|
Pointing the cursor at the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
|
|
Moving the cursor off of the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
|
|
Moving the cursor over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the Event class. Names of fields that are available via the Event.get method:
|
|
Letting go of the mouse button over an object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
|
|
End of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
|
|
Repeating event during multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
|
|
Start of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent.get method:
|
|
Change to the object options. Inherited from ICustomizable. |
|
The parent object reference changed. Data fields:
Inherited from IChild. |
|
Layer removed from the map. |
|
Mouse wheel scrolling. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
|
Methods
Name |
Returns |
Description |
getMap() |
Returns reference to the map. |
|
Allows to get the layer object in the specifed geo point at the current zoom level. The method call automatically downloads the tile which covers the point, if it is not yet downloaded. After that, the downloaded data will be used for searching. |
||
Allows to get the layer object in the specifed geo point at the current zoom level. The method call automatically downloads the tile which covers the point, if it is not yet downloaded. After that, the downloaded data will be used for searching. |
||
Returns source of objects for the hotspot layer. |
||
IParentOnMap|null |
Returns link to the parent object, or null if the parent element was not set. Inherited from IChildOnMap. |
|
Sets the parent object. If the null value is passed, the manager element will only be deleted from the current parent object. Inherited from IChildOnMap. |
||
update() |
Updates the hotspot layer. After this command has been executed, previously loaded objects are removed from the container and new data is requested. |
Fields details
balloon
{hotspot.layer.Balloon} balloon
Hotspot layer balloon.
hint
{hotspot.layer.Hint} hint
Hotspot layer hint.
Events details
addtomap
Layer added to the map.
balloonclose
Closing the balloon. Instance of the Event class.
balloonopen
Opening the balloon on the hotspot layer. Instance of the Event class.
click
Single left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
contextmenu
Calls the element's context menu. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
dblclick
Double left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
hintclose
Closing the hint. Instance of the Event class.
hintopen
Opening the hint on the hotspot layer. Instance of the Event class.
mousedown
Pressing the mouse button over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
mouseenter
Pointing the cursor at the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
mouseleave
Moving the cursor off of the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
mousemove
Moving the cursor over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the Event class. Names of fields that are available via the Event.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
mouseup
Letting go of the mouse button over an object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
multitouchend
End of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
multitouchmove
Repeating event during multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
multitouchstart
Start of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
removefrommap
Layer removed from the map.
wheel
Mouse wheel scrolling. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
- activeObject (hotspot.layer.Object) - The object of the layer where the event occurred.
- 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.
- pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
- 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.
Methods details
getMap
{Map} getMap()
Returns reference to the map.
getObjectInPosition
{vow.Promise} getObjectInPosition(coords)
Allows to get the layer object in the specifed geo point at the current zoom level. The method call automatically downloads the tile which covers the point, if it is not yet downloaded. After that, the downloaded data will be used for searching.
Returns the Promise object that will be resolved by the layer object covering the point. If the point falls on several layer objects, the object with the maximum zIndex will be returned.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number[] The geo coordinates of the point. |
* Mandatory parameter/option.
getObjectsInPosition
{vow.Promise} getObjectsInPosition(coords)
Allows to get the layer object in the specifed geo point at the current zoom level. The method call automatically downloads the tile which covers the point, if it is not yet downloaded. After that, the downloaded data will be used for searching.
Returns the Promise object that will be resolved by an array of layer objects covering the point.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number[] The geo coordinates of the point. |
* Mandatory parameter/option.
getObjectSource
{IHotspotObjectSource} getObjectSource()
Returns source of objects for the hotspot layer.
Example:
// Updating the data source for the hotspot layer.
hotspotLayer.getObjectSource().setTileUrlTemplate('newSource/?%c');
hotspotLayer.update();
update
{} update()
Updates the hotspot layer. After this command has been executed, previously loaded objects are removed from the container and new data is requested.
Mandatory parameter/option.