full invalidation only on animation end

This commit is contained in:
Francisco Dans 2015-02-26 16:06:39 +01:00
parent deacb1ae00
commit 3f9a8f4a18
2 changed files with 10 additions and 5 deletions

View File

@ -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);
@ -212,6 +214,7 @@ L.TorqueLayer = L.CanvasLayer.extend({
var ctx = canvas.getContext('2d');
var brrr = false;
for(t in this._tiles) {
tile = this._tiles[t];
if (tile) {
@ -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

View File

@ -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);
}
});