performs adjustment in the canvas layer instead of the torque layer

This commit is contained in:
Francisco Dans 2015-05-05 18:28:22 +02:00
parent 9ca2d5e774
commit 147cdbf1b4
2 changed files with 5 additions and 5 deletions

View File

@ -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();

View File

@ -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];