This commit is contained in:
javi 2013-10-18 15:32:31 +02:00
parent 6e3703b980
commit 4ce089aceb
3 changed files with 14 additions and 2 deletions

View File

@ -69,16 +69,17 @@
this.domain = this.domainInv.invert(); this.domain = this.domainInv.invert();
this.range = torque.math.linear(0, this.options.steps); this.range = torque.math.linear(0, this.options.steps);
this.rangeInv = this.range.invert(); this.rangeInv = this.range.invert();
this.time(this._time);
return this; return this;
}, },
duration: function(_) { duration: function(_) {
if (!arguments.length) return this.options.animationDuration; if (!arguments.length) return this.options.animationDuration;
this.options.animationDuration = _; this.options.animationDuration = _;
this.rescale();
if (this.time() > _) { if (this.time() > _) {
this.time(0); this.time(0);
} }
this.rescale();
return this; return this;
}, },

View File

@ -68,6 +68,8 @@ GMapsTorqueLayer.prototype = _.extend({},
self.fire("change:bounds", { self.fire("change:bounds", {
bounds: self.provider.getBounds() bounds: self.provider.getBounds()
}); });
self.animator.rescale();
self.setKey(self.key);
}; };
this.provider = new this.providers[this.options.provider](this.options); this.provider = new this.providers[this.options.provider](this.options);
@ -91,7 +93,7 @@ GMapsTorqueLayer.prototype = _.extend({},
}, },
setBlendMode: function(_) { setBlendMode: function(_) {
this.renderer.setBlendMode(_); this.renderer && this.renderer.setBlendMode(_);
this.redraw(); this.redraw();
}, },

View File

@ -53,6 +53,15 @@ L.TorqueLayer = L.CanvasLayer.extend({
self.redraw(); self.redraw();
}); });
}, this); }, this);
this.options.ready = function() {
self.fire("change:bounds", {
bounds: self.provider.getBounds()
});
self.animator.rescale();
self.setKey(self.key);
};
}, },
onRemove: function() { onRemove: function() {