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 Carrion 2015-06-23 14:43:44 +02:00
parent ebc1446063
commit 4ed644feaa

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));