map.ZoomRange

Extends IEventEmitter.

Map zoom level manager. Each map already has its own zoom level manager, available as map.zoomRange. Don't instantiate new instances of this class unless necessary.

See Map.zoomRange

Constructor | Fields | Events | Methods

Constructor

map.ZoomRange(map, constraints)

Parameters:

Parameter Default value Description
map *

Type: Map

Map.

constraints *

Type: Number[]

An array containing the minimum and maximum map zooms.

* Mandatory parameter/option.

Fields

Name Type Description
events IEventManager

Event manager.

Inherited from IEventEmitter.

Events

Name Description
change

Changes occurred in the map zoom range.

Methods

Name Returns Description
get([coords])

vow.Promise

Checks the available range of zoom levels at the specified point.

getCurrent()

Number[]

Returns the current (last received) values of the minimum and maximum map zoom levels.

Events details

change

Changes occurred in the map zoom range.

Methods details

get

Checks the available range of zoom levels at the specified point.

Returns a Promise object, which will be resolved and will get an array of two numbers as a parameter - the maximum and minimum zoom at the given point.

Parameters:

Parameter Default value Description
coords

Type: Number[]

Coordinates of a point. If omitted, the current map center is used.

Example:

// Finding the coordinates of the Yandex office and showing it on the map
// at the maximum possible zoom level.
ymaps.geocode('Moscow, Lev Tolstoy street, 16').then(function (res) {
    var coords = res.geoObjects.get(0).geometry.getCoordinates();
    map.zoomRange.get(coords).then(function (range) {
        map.setCenter(coords, range[1]);
    });
});

getCurrent

{Number[]} getCurrent()

Returns the current (last received) values of the minimum and maximum map zoom levels.