Merge pull request #197 from CartoDB/providerload

renderer and provider are loaded before options.ready is defined, to prevent them from being called before their initialization
This commit is contained in:
Dani Carrión 2015-06-23 16:24:55 +02:00
commit be7046e5a0

View File

@ -66,6 +66,9 @@ L.TorqueLayer = L.CanvasLayer.extend({
this.options.renderer = this.options.renderer || 'point';
this.options.provider = this.options.provider || 'windshaft';
this.provider = new this.providers[this.options.provider](options);
this.renderer = new this.renderers[this.options.renderer](this.getCanvas(), options);
options.ready = function() {
self.fire("change:bounds", {
bounds: self.provider.getBounds()
@ -78,9 +81,6 @@ L.TorqueLayer = L.CanvasLayer.extend({
self.setKey(self.key);
};
this.provider = new this.providers[this.options.provider](options);
this.renderer = new this.renderers[this.options.renderer](this.getCanvas(), options);
this.renderer.on("allIconsLoaded", this.render.bind(this));