Fix ol.source.CartoDB 'loading' state
This commit is contained in:
@@ -47,6 +47,7 @@ ol.source.CartoDB = function(options) {
|
|||||||
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18,
|
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18,
|
||||||
minZoom: options.minZoom,
|
minZoom: options.minZoom,
|
||||||
projection: options.projection,
|
projection: options.projection,
|
||||||
|
state: ol.source.State.LOADING,
|
||||||
wrapX: options.wrapX
|
wrapX: options.wrapX
|
||||||
});
|
});
|
||||||
this.initializeMap_();
|
this.initializeMap_();
|
||||||
@@ -100,8 +101,7 @@ ol.source.CartoDB.prototype.initializeMap_ = function() {
|
|||||||
this.applyTemplate_(this.templateCache_[paramHash]);
|
this.applyTemplate_(this.templateCache_[paramHash]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var mapUrl = 'https://' + this.account_ +
|
var mapUrl = 'https://' + this.account_ + '.cartodb.com/api/v1/map';
|
||||||
'.cartodb.com/api/v1/map';
|
|
||||||
|
|
||||||
if (this.mapId_) {
|
if (this.mapId_) {
|
||||||
mapUrl += '/named/' + this.mapId_;
|
mapUrl += '/named/' + this.mapId_;
|
||||||
@@ -135,6 +135,7 @@ ol.source.CartoDB.prototype.handleInitResponse_ = function(paramHash, event) {
|
|||||||
}
|
}
|
||||||
this.applyTemplate_(response);
|
this.applyTemplate_(response);
|
||||||
this.templateCache_[paramHash] = response;
|
this.templateCache_[paramHash] = response;
|
||||||
|
this.setState(ol.source.State.READY);
|
||||||
} else {
|
} else {
|
||||||
this.setState(ol.source.State.ERROR);
|
this.setState(ol.source.State.ERROR);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user