diff --git a/lib/torque/leaflet/torque.js b/lib/torque/leaflet/torque.js index 8fa8f58..2de2c38 100644 --- a/lib/torque/leaflet/torque.js +++ b/lib/torque/leaflet/torque.js @@ -60,6 +60,8 @@ L.TorqueLayer = L.CanvasLayer.extend({ this.setDuration = this.animator.duration.bind(this.animator); this.isRunning = this.animator.isRunning.bind(this.animator); + this.lastStep = 0; + L.CanvasLayer.prototype.initialize.call(this, options); @@ -211,6 +213,7 @@ L.TorqueLayer = L.CanvasLayer.extend({ this.renderer.clearCanvas(); var ctx = canvas.getContext('2d'); var brrr = false; + for(t in this._tiles) { tile = this._tiles[t]; @@ -234,7 +237,9 @@ L.TorqueLayer = L.CanvasLayer.extend({ } } } - if(!brrr) this.renderer.flush(); + var full = this.getStep() < this.lastStep; + this.lastStep = this.getStep(); + if(!brrr) this.renderer.flush(full); //this.renderer.applyFilters(); // prepare caches if the animation is not running diff --git a/lib/torque/renderer/point.js b/lib/torque/renderer/point.js index 90c919e..c467256 100644 --- a/lib/torque/renderer/point.js +++ b/lib/torque/renderer/point.js @@ -396,13 +396,13 @@ var ballRenderer = require('./ball.js'); } } }, - flush: function(){ + flush: function(full){ this._ctx.setTransform(1, 0, 0, 1, 0, 0); if(!this.ballRenderer) return; - this.ballRenderer.contour(8); - this.ballRenderer.isopleth(); + // this.ballRenderer.contour(4); + // this.ballRenderer.isopleth(); this.ballRenderer.draw(); - this.ballRenderer.invalidate(); + this.ballRenderer.invalidate(full); } });