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) {
|
function getMapBounds(callback) {
|
||||||
// get initial map bounds
|
if (!self.loaded) {
|
||||||
self.options.places({}, function(result) {
|
setTimeout(function() {
|
||||||
var area = result.data.area;
|
getMapBounds(callback);
|
||||||
callback(new google.maps.LatLngBounds(
|
}, 100);
|
||||||
new google.maps.LatLng(area.south, area.west),
|
} else {
|
||||||
new google.maps.LatLng(area.north, area.east)
|
// 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() {
|
function getMapHeight() {
|
||||||
|
@ -1426,7 +1432,13 @@ Ox.Map = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function zoom(z) {
|
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() {
|
function zoomChanged() {
|
||||||
|
|
Loading…
Reference in a new issue