Documentation
Reference
2.1.55 (current version)
collection
interactivityModel
Interfaces

control.ZoomControl

Extends IControl, ICustomizable.

The "Zoom" control. The key of the control in the storage. control.storage — "zoomControl".

Constructor | Fields | Events | Methods

Constructor

control.ZoomControl([parameters])

Parameters:

ParameterDefault valueDescription
parameters

Type: Object

Control parameters.

parameters.data

Type: Object

Control data.

parameters.options

Type: Object

Control options.

parameters.options.adjustMapMargin false

Type: Boolean

Whether the control registers its size in the map margins manager map.margin.Manager.

parameters.options.layout

Type: IZoomControlLayout|String

Constructor of the control layout or the layout key in the layout.storage. The layout constructor is passed an object containing the fields:

  • control - Reference to the control.
  • options - Control options manager control.ZoomControl.options.
  • data - Control data manager control.ZoomControl.data.
  • state - Control state manager control.ZoomControl.state.

parameters.options.position

Type: Object

Object describing the position of a control.

parameters.options.position.bottom 'auto'

Type: Number|String

Position relative to the bottom edge of the map.

parameters.options.position.left 10

Type: Number|String

Position relative to the left edge of the map.

parameters.options.position.right 'auto'

Type: Number|String

Position relative to the right edge of the map.

parameters.options.position.top 108

Type: Number|String

Position relative to the top edge of the map.

parameters.options.size 'auto'

Type: String

Defines the appearance of the control. Takes the following values:

  • 'small' — Always show a small zoom control.
  • 'large' — Always show a large zoom control.
  • 'auto' — Automatically select the size of the control depending on the height of the map container.

parameters.options.visible true

Type: Boolean

Indicates if the control is displayed.

parameters.options.zoomDuration 200

Type: Number

The length of animation playback when changing the zoom level.

parameters.options.zoomStep 1

Type: Number

Step of the zoom level change.

parameters.state

Type: Object

Object describing the state of a control.

Examples:

1.

// Example 1.
// Creating a small zoom control and adding it to the map.
var zoomControl = new ymaps.control.ZoomControl({
    options: {
        size: "small"
    }
});
myMap.controls.add(zoomControl);

2.

// Example 2.
// If the control was already added to the map using a key from control.storage.
myMap.controls.add('zoomControl', {
    size: "large"
});

Fields

NameTypeDescription
eventsIEventManager

Event manager.

Inherited from IEventEmitter.

optionsIOptionManager

Options manager.

Inherited from IControl.

Events

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

Methods

NameReturnsDescription
getMap()

Map

Returns reference to the map.

getParent()

IControlParent|null

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

Inherited from IControl.

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

Methods details

getMap

{Map} getMap()

Returns reference to the map.