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

Map margins manager

Save as filesEdit on JSFiddle

Manager for calculating optimal margins from the edges of the map container.

Each map has its own margins manager. To add an area over the map to the manager, use the addArea method. The addArea method returns an object (accessor) that represents the occupied rectangular area. The accessor allows you to change or remove an area from the object manager.

The area is described as an object containing information about offsets from the edge of the map and the size of this area. Either pixels (px) or percentages (%) can be used as units of measurement. Percentages are calculated relative to the size of the map container.

Controls support the adjustMapMargin option, which takes a Boolean value. When set to true, the control registers its dimensions in the map's margins manager.

multiRouter.MultiRoute and Clusterer support the useMapMargin option, which allows using the map margins.
Many of the map methods support this option, such as setBounds, panTo, and setCenter.