From 02d262e387a80c921d2a8634e0eac02a28a60dd5 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 4 Apr 2016 12:41:42 +0200 Subject: [PATCH] Fix ol.source.CartoDB 'loading' state --- src/ol/source/cartodb.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ol/source/cartodb.js b/src/ol/source/cartodb.js index 9ff67ac463..37a5c1de8c 100644 --- a/src/ol/source/cartodb.js +++ b/src/ol/source/cartodb.js @@ -47,6 +47,7 @@ ol.source.CartoDB = function(options) { maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18, minZoom: options.minZoom, projection: options.projection, + state: ol.source.State.LOADING, wrapX: options.wrapX }); this.initializeMap_(); @@ -100,8 +101,7 @@ ol.source.CartoDB.prototype.initializeMap_ = function() { this.applyTemplate_(this.templateCache_[paramHash]); return; } - var mapUrl = 'https://' + this.account_ + - '.cartodb.com/api/v1/map'; + var mapUrl = 'https://' + this.account_ + '.cartodb.com/api/v1/map'; if (this.mapId_) { mapUrl += '/named/' + this.mapId_; @@ -135,6 +135,7 @@ ol.source.CartoDB.prototype.handleInitResponse_ = function(paramHash, event) { } this.applyTemplate_(response); this.templateCache_[paramHash] = response; + this.setState(ol.source.State.READY); } else { this.setState(ol.source.State.ERROR); }