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,