Skip to content

Commit

Permalink
fix(build): Removed the center undefined log message as noted by @ngo…
Browse files Browse the repository at this point in the history
  • Loading branch information
tombatossals committed Dec 17, 2013
1 parent 46afaf1 commit a41e4ef
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
23 changes: 12 additions & 11 deletions dist/angular-leaflet-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,22 @@ angular.module("leaflet-directive").directive('center', function ($log, $parse,

controller.getMap().then(function(map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
if (isDefined(center)) {
if (center.autoDiscover === true) {
map.locate({ setView: true, maxZoom: defaults.maxZoom });
}

var centerModel = {
lat: $parse("center.lat"),
lng: $parse("center.lng"),
zoom: $parse("center.zoom")
};
} else {
$log.warn("[AngularJS - Leaflet] 'center' is undefined in the current scope, did you forget to initialize it?");
if (!isDefined(center)) {
map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom);
return;
}

if (center.autoDiscover === true) {
map.locate({ setView: true, maxZoom: defaults.maxZoom });
}

var centerModel = {
lat: $parse("center.lat"),
lng: $parse("center.lng"),
zoom: $parse("center.zoom")
};

var movingMap = false;

leafletScope.$watch("center", function(center) {
Expand Down
Loading

0 comments on commit a41e4ef

Please sign in to comment.