Ox.Map: make sure loading icon is actually present

This commit is contained in:
rolux 2013-06-02 01:58:47 +02:00
parent fc1192f156
commit 2d0fdae171

View file

@ -774,11 +774,11 @@ Ox.Map = function(options, self) {
// gets the largest place at latlng that would fit in bounds
var callback = arguments.length == 3 ? callback : bounds,
bounds = arguments.length == 3 ? bounds : null;
self.$loadingIcon.start();
self.$loadingIcon && self.$loadingIcon.start();
self.geocoder.geocode({
latLng: latlng
}, function(results, status) {
self.$loadingIcon.stop();
self.$loadingIcon && self.$loadingIcon.stop();
if (status == google.maps.GeocoderStatus.OK) {
if (bounds) {
Ox.forEach(results.reverse(), function(result, i) {
@ -810,11 +810,11 @@ Ox.Map = function(options, self) {
}
function getPlaceByName(name, callback) {
self.$loadingIcon.start();
self.$loadingIcon && self.$loadingIcon.start();
self.geocoder.geocode({
address: name
}, function(results, status) {
self.$loadingIcon.stop();
self.$loadingIcon && self.$loadingIcon.stop();
if (status == google.maps.GeocoderStatus.OK) {
callback(new Ox.MapPlace(parseGeodata(results[0])));
}