From 470e6ac127b297385e0dbd98171fa6fb7282ccf6 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 23 Mar 2015 17:37:58 +0530 Subject: [PATCH] wait until google.maps.LatLng is available --- source/UI/js/Map/Map.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/UI/js/Map/Map.js b/source/UI/js/Map/Map.js index 4cc62c3a..c501e8f2 100644 --- a/source/UI/js/Map/Map.js +++ b/source/UI/js/Map/Map.js @@ -514,7 +514,7 @@ Ox.Map = function(options, self) { setTimeout(initMap); } else if (window.googleCallback) { (function interval() { - window.google ? initMap() : setTimeout(interval, 100); + isLoaded() ? initMap() : setTimeout(interval, 100); }()); } else { window.googleCallback = function() { @@ -951,6 +951,10 @@ Ox.Map = function(options, self) { && southWest.lng() == northEast.lng(); } + function isLoaded() { + return window.google && window.google.maps && window.google.maps.LatLng; + } + function mapChanged() { // This is the handler that actually adds the places to the map. // Gets called after panning or zooming, and when the map is idle.