Merge pull request #108 from cadecairos/t1162

Add existence check for newdiv variable in googlemap ready callback [#11...
This commit is contained in:
Christopher De Cairos 2012-06-19 12:19:32 -07:00
Родитель 7089d4bd88 13f1b8ec5a
Коммит c25078ef00
1 изменённых файлов: 17 добавлений и 15 удалений

Просмотреть файл

@ -150,21 +150,23 @@ var googleCallback;
// before setting up the map parameters
var isMapReady = function () {
if ( _mapLoaded ) {
if ( options.location ) {
// calls an anonymous google function called on separate thread
geocoder.geocode({
"address": options.location
}, function ( results, status ) {
if ( status === google.maps.GeocoderStatus.OK ) {
options.lat = results[ 0 ].geometry.location.lat();
options.lng = results[ 0 ].geometry.location.lng();
location = new google.maps.LatLng( options.lat, options.lng );
map = buildMap( options, location, newdiv );
}
});
} else {
location = new google.maps.LatLng( options.lat, options.lng );
map = buildMap( options, location, newdiv );
if ( newdiv ) {
if ( options.location ) {
// calls an anonymous google function called on separate thread
geocoder.geocode({
"address": options.location
}, function ( results, status ) {
if ( status === google.maps.GeocoderStatus.OK ) {
options.lat = results[ 0 ].geometry.location.lat();
options.lng = results[ 0 ].geometry.location.lng();
location = new google.maps.LatLng( options.lat, options.lng );
map = buildMap( options, location, newdiv );
}
});
} else {
location = new google.maps.LatLng( options.lat, options.lng );
map = buildMap( options, location, newdiv );
}
}
} else {
setTimeout(function () {