From bfd28c9a7ddcb0b3738055d3e025c0048b8ff19d Mon Sep 17 00:00:00 2001 From: Francisco Dans Date: Wed, 13 May 2015 16:02:18 +0200 Subject: [PATCH] makes sure that no pixels are drawn out of bounds --- lib/torque/renderer/ball.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/torque/renderer/ball.js b/lib/torque/renderer/ball.js index 2f4404b..4e55750 100644 --- a/lib/torque/renderer/ball.js +++ b/lib/torque/renderer/ball.js @@ -21,17 +21,27 @@ function BallRenderer(thecanvas){ this.availableWorkers = 10; this.mode = "heat"; this.cachedBalls = []; + this.initialize(); } BallRenderer.prototype = { + initialize: function(){ + var self = this; + this.torqueLayer._map.on("movestart", function(){ + self.transit = true + }); + this.torqueLayer._map.on("moveend", function(){ + self.transit = false + }); + }, getBallIndices: function(x, y){ var indices = new Int8Array(2*r+1); - return indices; }, addBall: function(x0, y0, st){ this.radius = st["marker-width"]; this.RW4 = this.radius * this.width *4; if(this.cachedBalls[this.radius]){ + if(x0 < 0 || y0 < 0 || x0 > this.width || y0 > this.height) return; var startingPoint = this.getRIndexPos(x0, y0) - this.RW4 - this.radius*4; var i = 0, pointer = startingPoint,