From 4ce089acebec9b93e542753c57cf2931ac7e89c8 Mon Sep 17 00:00:00 2001 From: javi Date: Fri, 18 Oct 2013 15:32:31 +0200 Subject: [PATCH] fixes --- lib/torque/animator.js | 3 ++- lib/torque/gmaps/torque.js | 4 +++- lib/torque/leaflet/torque.js | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) 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() {