Skip to content

Commit

Permalink
FIX #12
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Gusev committed Sep 14, 2015
1 parent 978af4e commit e20d5d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion angular-ymaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,14 @@ angular.module('ymaps', [])
function initAutoFit(map, collection, ymaps) {
collection.events.add('boundschange', debounce(function () {
if(collection.getLength() > 0) {
var maxZoomBefore = map.options.get('maxZoom');
map.options.set('maxZoom', $scope.zoom);
map.setBounds(collection.getBounds(), {
checkZoomRange: true,
zoomMargin: config.fitMarkersZoomMargin
}).then(function () {
if(map.getZoom() > $scope.zoom) map.setZoom($scope.zoom);
map.options.set('maxZoom', maxZoomBefore);
map.setZoom(map.getZoom()); // Setting current zoom. Without this the plus button on the yandex map doesn't get updated after .set('maxZoom').
});
}
}, 100));
Expand Down

0 comments on commit e20d5d0

Please sign in to comment.