Merge pull request #255 from CartoDB/key_fix

fixed ready event when using range rendering
This commit is contained in:
javi santana 2016-02-15 10:45:54 +01:00
commit 99e8a242e4
2 changed files with 16 additions and 2 deletions

View File

@ -107,7 +107,7 @@ GMapsTorqueLayer.prototype = torque.extend({},
self.fire('change:steps', {
steps: self.provider.getSteps()
});
self.setKey(self.getKey());
self.setKeys(self.getKeys());
};
this.provider = new this.providers[this.options.provider](this.options);
@ -241,6 +241,13 @@ GMapsTorqueLayer.prototype = torque.extend({},
this.setKeys([key]);
},
/**
* returns the array of keys being rendered
*/
getKeys: function() {
return this.keys;
},
setKeys: function(keys) {
this.keys = keys;
this.animator.step(this.getKey());

View File

@ -89,7 +89,7 @@ L.TorqueLayer = L.CanvasLayer.extend({
self.fire('change:steps', {
steps: self.provider.getSteps()
});
self.setKey(self.getKey());
self.setKeys(self.getKeys());
};
this.renderer.on("allIconsLoaded", this.render.bind(this));
@ -286,6 +286,13 @@ L.TorqueLayer = L.CanvasLayer.extend({
this.setKeys([key], options);
},
/**
* returns the array of keys being rendered
*/
getKeys: function() {
return this.keys;
},
setKeys: function(keys, options) {
this.keys = keys;
this.animator.step(this.getKey());