Make a local variable of ctx

This commit is contained in:
Francisco López 2017-02-08 15:03:45 +01:00 committed by GitHub
parent 79c48b5521
commit ee95c112f9

View File

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