When creating a map, I specify the maximum zoom and setDefaultMargin in the same setDefaultMargin :

 var map = new ymaps.Map('map', { center: [55.76, 37.64], zoom: 7, maxZoom: 12 }); map.margin.setDefaultMargin([0,600,0,0]); 

However, when I do map.setBounds(map.geoObjects.getBounds()); neither padding nor zoom is taken into account. I struggle with zoom like this:

 if (map.getZoom() > 16) map.setZoom(16); // максимальный зум 

And I don’t know what to do with indents.

    1 answer 1

    maxZoom is an option and needs to be set like this:

     var map = new ymaps.Map('map', { center: [55.76, 37.64], zoom: 7 }, { maxZoom: 12 }); 
    • Yes - really - it works that way. And what about indents? I admit honestly I didn’t even understand much from the documentation how they are considered. But I try to display the check: they are set: margin.getOffset () returns [-300, 0] (by the way, why not 600?) Margin.getMargin () - [0, 600, 0, 0] But I don’t see any visible effect. - Suntechnic
    • one
      In the sandbox there is an example of how to use the indents of tech.yandex.ru/maps/jsbox/2.1/margin_manager . Also note that the setBounds method does not consider indents by default. In order for it to take them into account you need to pass the option useMapMargin map.setBounds ([[60, -40], [20.60]], {useMapMargin: true,}) Documentation: tech.yandex.ru/maps/doc/jsapi/ 2.1 / ref / reference / Map-docpage / ... - se0ga