only call getMapBounds if loaded
This commit is contained in:
parent
0de8f278da
commit
9129908cf8
1 changed files with 9 additions and 15 deletions
|
@ -138,7 +138,7 @@ Ox.Map = function(options, self) {
|
|||
sort: '-area'
|
||||
});
|
||||
}
|
||||
getMapBounds(function(mapBounds) {
|
||||
self.loaded && getMapBounds(function(mapBounds) {
|
||||
if (mapBounds) {
|
||||
self.map.fitBounds(mapBounds);
|
||||
} else {
|
||||
|
@ -714,11 +714,6 @@ Ox.Map = function(options, self) {
|
|||
}
|
||||
|
||||
function getMapBounds(callback) {
|
||||
if (!window.google) {
|
||||
setTimeout(function() {
|
||||
getMapBounds(callback);
|
||||
}, 100);
|
||||
} else {
|
||||
// get initial map bounds
|
||||
self.options.places({}, function(result) {
|
||||
var area = result.data.area;
|
||||
|
@ -728,7 +723,6 @@ Ox.Map = function(options, self) {
|
|||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getMapHeight() {
|
||||
return self.options.height
|
||||
|
|
Loading…
Reference in a new issue