wait for google maps to be loaded
This commit is contained in:
parent
95e6e4c36f
commit
7bb3d5d185
1 changed files with 21 additions and 9 deletions
|
@ -714,14 +714,20 @@ Ox.Map = function(options, self) {
|
|||
}
|
||||
|
||||
function getMapBounds(callback) {
|
||||
// get initial map bounds
|
||||
self.options.places({}, function(result) {
|
||||
var area = result.data.area;
|
||||
callback(new google.maps.LatLngBounds(
|
||||
new google.maps.LatLng(area.south, area.west),
|
||||
new google.maps.LatLng(area.north, area.east)
|
||||
));
|
||||
});
|
||||
if (!self.loaded) {
|
||||
setTimeout(function() {
|
||||
getMapBounds(callback);
|
||||
}, 100);
|
||||
} else {
|
||||
// get initial map bounds
|
||||
self.options.places({}, function(result) {
|
||||
var area = result.data.area;
|
||||
callback(new google.maps.LatLngBounds(
|
||||
new google.maps.LatLng(area.south, area.west),
|
||||
new google.maps.LatLng(area.north, area.east)
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getMapHeight() {
|
||||
|
@ -1426,7 +1432,13 @@ Ox.Map = function(options, self) {
|
|||
}
|
||||
|
||||
function zoom(z) {
|
||||
self.map.setZoom(self.map.getZoom() + z);
|
||||
if (!self.loaded) {
|
||||
setTimeout(function() {
|
||||
zoom(z);
|
||||
}, 100);
|
||||
} else {
|
||||
self.map.setZoom(self.map.getZoom() + z);
|
||||
}
|
||||
}
|
||||
|
||||
function zoomChanged() {
|
||||
|
|
Loading…
Reference in a new issue