From b9442034ef6631de0e200031b89fcd0eb5f218b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= Date: Wed, 8 Feb 2017 10:27:51 +0100 Subject: [PATCH] Remove width trick to use clear rect, fix #280 --- lib/torque/renderer/point.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/torque/renderer/point.js b/lib/torque/renderer/point.js index 9e6007d..3b4fc7a 100644 --- a/lib/torque/renderer/point.js +++ b/lib/torque/renderer/point.js @@ -57,7 +57,7 @@ var Filters = require('./torque_filters'); this.TILE_SIZE = 256; this._style = null; this._gradients = {}; - + this._forcePoints = false; } @@ -68,7 +68,10 @@ var Filters = require('./torque_filters'); var color = this._Map['-torque-clear-color'] // shortcut for the default value if (color === "rgba(255, 255, 255, 0)" || !color) { - this._canvas.width = this._canvas.width; + this._ctx.save(); + this._ctx.setTransform(1, 0, 0, 1, 0, 0); + this._ctx.clearRect(0, 0, canvas.width, canvas.height); + this._ctx.restore(); } else { var ctx = this._ctx; ctx.setTransform(1, 0, 0, 1, 0, 0); @@ -165,7 +168,7 @@ var Filters = require('./torque_filters'); i.src = canvas.toDataURL(); return i; } - + return canvas; }, @@ -193,7 +196,7 @@ var Filters = require('./torque_filters'); } } } - + prof.end(true); return callback && callback(null); @@ -237,7 +240,7 @@ var Filters = require('./torque_filters'); }, // - // renders a tile in the canvas for key defined in + // renders a tile in the canvas for key defined in // the torque tile // _renderTile: function(tile, key, frame_offset, sprites, shader, shaderVars) { @@ -274,7 +277,7 @@ var Filters = require('./torque_filters'); } } } - + prof.end(true); }, @@ -425,7 +428,7 @@ var Filters = require('./torque_filters'); } gradient = {}; var colorize = this._style['image-filters'].args; - + var increment = 1/colorize.length; for (var i = 0; i < colorize.length; i++){ var key = increment * i + increment;