diff --git a/lib/torque/animator.js b/lib/torque/animator.js index 1e90baa..35c732e 100644 --- a/lib/torque/animator.js +++ b/lib/torque/animator.js @@ -69,16 +69,17 @@ this.domain = this.domainInv.invert(); this.range = torque.math.linear(0, this.options.steps); this.rangeInv = this.range.invert(); + this.time(this._time); return this; }, duration: function(_) { if (!arguments.length) return this.options.animationDuration; this.options.animationDuration = _; - this.rescale(); if (this.time() > _) { this.time(0); } + this.rescale(); return this; }, diff --git a/lib/torque/gmaps/torque.js b/lib/torque/gmaps/torque.js index 40fbcdc..ea34c7f 100644 --- a/lib/torque/gmaps/torque.js +++ b/lib/torque/gmaps/torque.js @@ -68,6 +68,8 @@ GMapsTorqueLayer.prototype = _.extend({}, self.fire("change:bounds", { bounds: self.provider.getBounds() }); + self.animator.rescale(); + self.setKey(self.key); }; this.provider = new this.providers[this.options.provider](this.options); @@ -91,7 +93,7 @@ GMapsTorqueLayer.prototype = _.extend({}, }, setBlendMode: function(_) { - this.renderer.setBlendMode(_); + this.renderer && this.renderer.setBlendMode(_); this.redraw(); }, diff --git a/lib/torque/leaflet/torque.js b/lib/torque/leaflet/torque.js index 83a1da4..e117f24 100644 --- a/lib/torque/leaflet/torque.js +++ b/lib/torque/leaflet/torque.js @@ -53,6 +53,15 @@ L.TorqueLayer = L.CanvasLayer.extend({ self.redraw(); }); }, this); + + this.options.ready = function() { + self.fire("change:bounds", { + bounds: self.provider.getBounds() + }); + self.animator.rescale(); + self.setKey(self.key); + }; + }, onRemove: function() {