Version:
Popular examples
Map
Geo objects
Balloon and hint
Controls
Hotspots
Regions
Clustering
GeoQuery
Behaviors and events
Search on a map
Traffic
User's location
Routing
YMapsML
GeoXML
ObjectManager
Modular system
Panoramas
External modules

Standard sets of controls

Save as filesEdit on JSFiddle

Each control is implemented by a separate class from the control namespace (e.g. control.TrafficControl). The reference to the controls is contained in the controls field of the map. To add or remove a control, use the "add" and "remove" methods, respectively.

In the API 2.1, controls can also be added to the map through its parameters. This means that when you initialize the map, you can specify the key of the corresponding control in the "controls" field.

You can add individual controls, or an entire set at once. The API 2.1 has three standard sets of controls available using the following keys:

  • 'smallMapDefaultSet';
  • 'mediumMapDefaultSet' (default);
  • 'largeMapDefaultSet'.

The sets differ in the number of controls included in them, as well as the size of the buttons. A set can be added depending on the size of the map. When the map is created, the 'mediumMapDefault' set is added automatically. However, if the map is fairly large, it is advisable to add 'largeMapDefaultSet'. If controls will not fit on the map when it is resized, the API will automatically reduce the size of icons.

For more information about available sets of controls, see the Reference.