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