Skip to content

Commit 1002cd3

Browse files
committed
2 parents eebb6ac + 7ab876b commit 1002cd3

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

build/scripts/ng-map.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ angular.module('ngMap', []);
572572

573573
scope.$watch('[' + varsToWatch.join(',') + ']', function() {
574574
customMarker.setContent(orgHtml, scope);
575-
});
575+
}, true);
576576

577577
customMarker.setContent(element[0].innerHTML, scope);
578578
var classNames = element[0].firstElementChild.className;
@@ -3213,4 +3213,4 @@ angular.module('ngMap', []);
32133213

32143214

32153215
return 'ngMap';
3216-
}));
3216+
}));

controllers/map-controller.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
for (var k2 in vm.map.customMarkers) {
103103
bounds.extend(vm.map.customMarkers[k2].getPosition());
104104
}
105+
if (vm.mapOptions.maximumZoom) {
106+
vm.enableMaximumZoomCheck = true; //enable zoom check after resizing for markers
107+
}
105108
vm.map.fitBounds(bounds);
106109
};
107110

@@ -210,6 +213,18 @@
210213
$parse($attrs.mapInitialized)($scope, {map: vm.map});
211214
}
212215
});
216+
217+
//add maximum zoom listeners if zoom-to-include-markers and and maximum-zoom are valid attributes
218+
if (mapOptions.zoomToIncludeMarkers && mapOptions.maximumZoom) {
219+
google.maps.event.addListener(vm.map, 'zoom_changed', function() {
220+
if (vm.enableMaximumZoomCheck == true) {
221+
vm.enableMaximumZoomCheck = false;
222+
google.maps.event.addListenerOnce(vm.map, 'bounds_changed', function() {
223+
vm.map.setZoom(Math.min(mapOptions.maximumZoom, vm.map.getZoom()));
224+
});
225+
}
226+
});
227+
}
213228
};
214229

215230
$scope.google = google; //used by $scope.eval to avoid eval()

directives/custom-marker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151

152152
scope.$watch('[' + varsToWatch.join(',') + ']', function() {
153153
customMarker.setContent(orgHtml, scope);
154-
});
154+
}, true);
155155

156156
customMarker.setContent(element[0].innerHTML, scope);
157157
var classNames = element[0].firstElementChild.className;

testapp/places-auto-complete.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@
3939
Location: {{vm.place.geometry.location}}<br/>
4040
</div>
4141
address : {{vm.address}}
42-
<map></ng-map>
42+
<ng-map></ng-map>
4343
</body>
4444
</html>

0 commit comments

Comments
 (0)