From e20d5d0055a91401ff3590c45973fefb9500a6f3 Mon Sep 17 00:00:00 2001 From: Alexander Gusev Date: Mon, 14 Sep 2015 12:02:54 +0300 Subject: [PATCH] FIX #12 --- angular-ymaps.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/angular-ymaps.js b/angular-ymaps.js index 3815156..40d7cb3 100644 --- a/angular-ymaps.js +++ b/angular-ymaps.js @@ -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));