Documentation
Reference
2.1.50 (current version)
collection
interactivityModel
Interfaces

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:

ParameterDefault valueDescription
objectSource *
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: IHotspotObjectSource

Source of objects for the layer.

options

Type: Object

Layer options. Options for balloons Balloon and hints Hint on the hotspot layer must be indicated with the "balloon" and "hint" prefixes.

options.cursor 'pointer'

Type: String

Type of cursor.

options.dontChangeCursor false

Type: Boolean

Option that prevents changing the cursor when pointing at an object on the layer. By default, cursors change.

options.hasBalloon 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.

options.hasHint 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.

options.interactivityModel 'default#layer'

Type: String

Interactivity model for the layer. Available keys and their values are listed in the description of interactivityModel.storage.

options.openBalloonOnClick true

Type: Boolean

Option that prevents opening the balloon when clicking on a hotspot object. By default, opening the balloon is allowed.

options.openEmptyBalloon false

Type: String

Open the balloon with empty contents.

options.openEmptyHint false

Type: String

Show a popup hint with empty contents.

options.openHintOnHover true

Type: Boolean

Option that prevents showing the hint when pointing at a hotspot object. By default, showing hints is allowed.

options.pane 'events'

Type: IEventPane

Container with map elements that events are listened on.

options.zIndex

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

NameTypeDescription
balloonhotspot.layer.Balloon

Hotspot layer balloon.

eventsIEventManager

Event manager.

Inherited from IEventEmitter.

hinthotspot.layer.Hint

Hotspot layer hint.

optionsIOptionManager

Options manager.

Inherited from ICustomizable.

Events

NameDescription
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. 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. 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. 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. 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. 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. 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. 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.

optionschange

Change to the object options.

Inherited from ICustomizable.

parentchange

The parent object reference changed.

Data fields:

  • oldParent - Old parent.
  • newParent - New parent.

Inherited from IChild.

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. 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

NameReturnsDescription
getMap()

Map

Returns reference to the map.

getObjectInPosition(coords)

vow.Promise

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.

getObjectsInPosition(coords)

vow.Promise

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.

getObjectSource()

IHotspotObjectSource

Returns source of objects for the hotspot layer.

getParent()

IControlParent|null

Returns link to the parent object, or null if the parent element was not set.

Inherited from IChildOnMap.

setParent(parent)

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.

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. 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. 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. 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. 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. 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. 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. 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. 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:

ParameterDefault valueDescription
coords*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

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:

ParameterDefault valueDescription
coords*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

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.