Make a local variable of ctx

clear-rect
Francisco López 8 years ago committed by GitHub
parent 79c48b5521
commit ee95c112f9

@ -88,13 +88,13 @@ var CartoDatasource = require('./datasource');
var canvas = this._canvas;
var color = this._Map['-torque-clear-color']
// shortcut for the default value
var ctx = this._ctx;
if (color === "rgba(255, 255, 255, 0)" || !color) {
this._ctx.save();
this._ctx.setTransform(1, 0, 0, 1, 0, 0);
this._ctx.clearRect(0, 0, canvas.width, canvas.height);
this._ctx.restore();
ctx.save();
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.restore();
} else {
var ctx = this._ctx;
ctx.setTransform(1, 0, 0, 1, 0, 0);
var compop = this._Map['comp-op']
ctx.globalCompositeOperation = compop2canvas(compop) || compop;

Loading…
Cancel
Save