diff --git a/src/canvas/canvasRenderer.js b/src/canvas/canvasRenderer.js index 09c96e38f3..2259d1e4d9 100644 --- a/src/canvas/canvasRenderer.js +++ b/src/canvas/canvasRenderer.js @@ -112,8 +112,7 @@ var canvasRenderer = function (arg) { this._renderFrame = function () { var layer = m_this.layer(), map = layer.map(), - camera = map.camera(), - viewport = camera._viewport, + mapSize = map.size(), features = layer.features(), i; @@ -129,7 +128,7 @@ var canvasRenderer = function (arg) { // Clear the canvas. if (m_clearCanvas) { m_this.context2d.setTransform(1, 0, 0, 1, 0, 0); - m_this.context2d.clearRect(0, 0, viewport.width, viewport.height); + m_this.context2d.clearRect(0, 0, mapSize.width, mapSize.height); } for (i = 0; i < features.length; i += 1) { diff --git a/src/canvas/heatmapFeature.js b/src/canvas/heatmapFeature.js index e2a75784be..bed5fcffbc 100644 --- a/src/canvas/heatmapFeature.js +++ b/src/canvas/heatmapFeature.js @@ -204,11 +204,11 @@ var canvas_heatmapFeature = function (arg) { intensityFunc = m_this.intensity(), minIntensity = m_this.minIntensity(), rangeIntensity = (m_this.maxIntensity() - minIntensity) || 1, - viewport = map.camera()._viewport, + mapSize = map.size(), bins = [], rw = Math.ceil(radius / binSize), - maxx = Math.ceil(viewport.width / binSize) + rw * 2 + 2, - maxy = Math.ceil(viewport.height / binSize) + rw * 2 + 2, + maxx = Math.ceil(mapSize.width / binSize) + rw * 2 + 2, + maxy = Math.ceil(mapSize.height / binSize) + rw * 2 + 2, datalen = data.length, idx, pos, intensity, x, y, binrow, offsetx, offsety; @@ -303,14 +303,14 @@ var canvas_heatmapFeature = function (arg) { binned = m_this.binned(), canvas, pixelArray, layer = m_this.layer(), - viewport = map.camera()._viewport; + mapSize = map.size(); /* Determine if we should bin the data */ if (binned === true || binned === 'auto') { binned = Math.max(Math.floor(radius / 8), 3); if (m_this.binned() === 'auto') { - var numbins = (Math.ceil((viewport.width + radius * 2) / binned) * - Math.ceil((viewport.height + radius * 2) / binned)); + var numbins = (Math.ceil((mapSize.width + radius * 2) / binned) * + Math.ceil((mapSize.height + radius * 2) / binned)); if (numbins >= data.length) { binned = 0; } @@ -323,7 +323,7 @@ var canvas_heatmapFeature = function (arg) { m_this._binned = binned; context2d.setTransform(1, 0, 0, 1, 0, 0); - context2d.clearRect(0, 0, viewport.width, viewport.height); + context2d.clearRect(0, 0, mapSize.width, mapSize.height); m_heatMapTransform = ''; map.scheduleAnimationFrame(m_this._setTransform, false); layer.canvas().css({transform: ''});