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 |
|
— |
Type: Map Map. |
— |
Type: Number[] An array containing the minimum and maximum map zooms. |
* Mandatory parameter/option.
Fields
Name |
Type |
Description |
Event manager. Inherited from IEventEmitter. |
Events
Name |
Description |
Changes occurred in the map zoom range. |
Methods
Name |
Returns |
Description |
Checks the available range of zoom levels at the specified point. |
||
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
{vow.Promise} get([coords])
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 |
— |
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.
Mandatory parameter/option.