objectManager.Hint

Extends IHintManager.

Manager of the hint on an object layer. Allows to manage the hint on an object layer by opening it and hiding it. It uses the map hint manager map.Hint inside itself. Object layers contains instances of this class, accessible as myObjectManager.objects.hint and myObjectManager.clusters.hint. Don't create new instances of this class unless necessary.

See Hint

Constructor | Fields | Events | Methods

Constructor

objectManager.Hint(collection)

Parameters:

Parameter

Default value

Description

collection*

Type: IReadOnlyCollection

Object layer.

* Mandatory parameter/option.

Fields

Name

Type

Description

events

IEventManager

Event manager.

Inherited from IEventEmitter.

Events

Name

Description

close

Closing the info object. Names of fields available via Event.get:

  • target - Reference to the object where the closing occurred.

Inherited from IPopupManager.

open

Opening the info object. Names of fields available via Event.get:

  • target - Reference to the object where the opening occurred.

Inherited from IPopupManager.

Methods

Name

Returns

Description

close([force])

vow.Promise

Hides the popup hint.

destroy()

Disables the info object manager.

Inherited from IPopupManager.

getData()

Object|null

Returns hash describing the object the hint is shown on, or null if the hint was not shown.

getOptions()

IOptionManager|null

Returns the options manager or 'null'.

Inherited from IPopupManager.

getOverlay()

vow.Promise

Returns the promise object to return the overlay.

Inherited from IPopupManager.

getOverlaySync()

IOverlay|null

Returns the overlay, if one exists.

Inherited from IPopupManager.

getPosition()

Number[]|null

Returns the coordinates of the info object or 'null'.

Inherited from IPopupManager.

isOpen(id)

Boolean

A method that determines whether the popup hint was shown on the object with the passed ID.

open(objectId[, position])

vow.Promise

Displays the popup hint on the object with the passed ID.

setData(objectData)

vow.Promise

Sets new data for displaying the popup hint.

setOptions(options)

vow.Promise

Defines new options for the info object.

Inherited from IPopupManager.

setPosition(position)

vow.Promise

Specifies a new position for the info object.

Inherited from IPopupManager.

Methods details

close

{vow.Promise} close([force])

Hides the popup hint.

Returns Promise object.

Parameters:

Parameter

Default value

Description

force

false

Type: Boolean

Instant closure.

Example:

// Closing all hints on a layer.
objectManager.objects.hint.close();
objectManager.clusters.hint.close();

getData

{Object|null} getData()

Returns hash describing the object the hint is shown on, or null if the hint was not shown.

Example:

var cluster = objectManager.clusters.hint.getData();
if (cluster) {
    alert('Cluster displays a hint.');
}

isOpen

{Boolean} isOpen(id)

A method that determines whether the popup hint was shown on the object with the passed ID.

Returns hint state: shown/hidden.

Parameters:

Parameter

Default value

Description

id*

Type: Object

Object ID.

* Mandatory parameter/option.

Example:

// Closing the hint when the object is clicked.
objectManager.objects.add('click', function (e) {
    var objectId = e.get('objectId');
    if (objectManager.objects.hint.isOpen(objectId)) {
        objectManager.objects.hint.close();
    }
});

open

{vow.Promise} open(objectId[, position])

Displays the popup hint on the object with the passed ID.

Returns Promise object.

Parameters:

Parameter

Default value

Description

objectId*

Type: Object

ID of the object to open the hint on.

position

Type: Number[]

The position for showing the popup hint, in global pixel coordinates. If the value is not specified, the hint will appear at the geometric center of the object.

* Mandatory parameter/option.

Example:

objectManager.clusters.hint.open(objectId);

setData

{vow.Promise} setData(objectData)

Sets new data for displaying the popup hint.

Returns Promise object.

Parameters:

Parameter

Default value

Description

objectData*

Type: Object

Hash with a description of the object to open the hint on. Corresponds to the object description that is input to ObjectManager.add.

* Mandatory parameter/option.

Example:

objectManager.objects.hint.setData(objectManager.objects.getById(objectId));