From 147cdbf1b4ac6b9ff3c6e71800a163f38ac65517 Mon Sep 17 00:00:00 2001 From: Francisco Dans Date: Tue, 5 May 2015 18:28:22 +0200 Subject: [PATCH] performs adjustment in the canvas layer instead of the torque layer --- lib/torque/leaflet/canvas_layer.js | 6 +++++- lib/torque/leaflet/torque.js | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/torque/leaflet/canvas_layer.js b/lib/torque/leaflet/canvas_layer.js index 642ef77..df3fc5e 100644 --- a/lib/torque/leaflet/canvas_layer.js +++ b/lib/torque/leaflet/canvas_layer.js @@ -85,7 +85,7 @@ L.CanvasLayer = L.Class.extend({ }, this); map.on({ 'viewreset': this._reset }, this); - map.on('move', this.render, this); + map.on('move', this.redraw, this); map.on('resize', this._reset, this); if (this.options.zoomAnimation) { @@ -233,6 +233,10 @@ L.CanvasLayer = L.Class.extend({ // use direct: true if you are inside an animation frame call redraw: function(direct) { if (direct) { + var domPosition = L.DomUtil.getPosition(this._map.getPanes().mapPane); + if (domPosition) { + L.DomUtil.setPosition(this._canvas, { x: -domPosition.x, y: -domPosition.y }); + } this.render(); } else { this._render(); diff --git a/lib/torque/leaflet/torque.js b/lib/torque/leaflet/torque.js index 818a6a8..ff05f50 100644 --- a/lib/torque/leaflet/torque.js +++ b/lib/torque/leaflet/torque.js @@ -212,10 +212,6 @@ L.TorqueLayer = L.CanvasLayer.extend({ var canvas = this.getCanvas(); this.renderer.clearCanvas(); var ctx = canvas.getContext('2d'); - var domPosition = L.DomUtil.getPosition(this._map.getPanes().mapPane); - if (domPosition) { - L.DomUtil.setPosition(this._canvas, { x: -domPosition.x, y: -domPosition.y }); - } for(t in this._tiles) { tile = this._tiles[t];