wait until google.maps.LatLng is available

This commit is contained in:
j 2015-03-23 17:37:58 +05:30
parent f302db9490
commit 470e6ac127

View file

@ -514,7 +514,7 @@ Ox.Map = function(options, self) {
setTimeout(initMap); setTimeout(initMap);
} else if (window.googleCallback) { } else if (window.googleCallback) {
(function interval() { (function interval() {
window.google ? initMap() : setTimeout(interval, 100); isLoaded() ? initMap() : setTimeout(interval, 100);
}()); }());
} else { } else {
window.googleCallback = function() { window.googleCallback = function() {
@ -951,6 +951,10 @@ Ox.Map = function(options, self) {
&& southWest.lng() == northEast.lng(); && southWest.lng() == northEast.lng();
} }
function isLoaded() {
return window.google && window.google.maps && window.google.maps.LatLng;
}
function mapChanged() { function mapChanged() {
// This is the handler that actually adds the places to the map. // This is the handler that actually adds the places to the map.
// Gets called after panning or zooming, and when the map is idle. // Gets called after panning or zooming, and when the map is idle.