harmonises iso and point renderers
This commit is contained in:
parent
595c254dbe
commit
26653967ac
@ -218,6 +218,7 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
var ctx = canvas.getContext('2d');
|
||||
var self = this;
|
||||
if (Object.keys(this._tiles).length > 0){
|
||||
if (this.options.renderer === "iso"){
|
||||
var min = {q: Infinity, w: new Set(), h: new Set()};
|
||||
for(var key in this._tiles){
|
||||
var coord = this._tiles[key].coord;
|
||||
@ -236,7 +237,7 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
for (var i = 0; i < this.renderer.globalGrid.length; i++){
|
||||
this.renderer.globalGrid[i] = Array.apply(null, Array(this.renderer.tileDimensions.w * valsPerTile)).map(Number.prototype.valueOf,0);
|
||||
}
|
||||
|
||||
}
|
||||
for(t in this._tiles) {
|
||||
tile = this._tiles[t];
|
||||
if (tile) {
|
||||
@ -246,6 +247,9 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
}
|
||||
|
||||
pos = this.getTilePos(tile.coord);
|
||||
if(this.options.renderer !== "iso"){
|
||||
ctx.setTransform(1, 0, 0, 1, pos.x, pos.y);
|
||||
}
|
||||
|
||||
if (tile._tileCache) {
|
||||
// when the tile has a cached image just render it and avoid to render
|
||||
@ -253,13 +257,15 @@ L.TorqueLayer = L.CanvasLayer.extend({
|
||||
ctx.setTransform(1, 0, 0, 1, pos.x, pos.y);
|
||||
this.renderer._ctx.drawImage(tile._tileCache, 0, 0);
|
||||
} else {
|
||||
if(this.options.renderer === "iso"){
|
||||
ctx.setTransform(1, 0, 0, 1, this.renderer.firstTileCoords.pos.x, this.renderer.firstTileCoords.pos.y);
|
||||
}
|
||||
this.renderer.renderTile(tile, this.key, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!tile._tileCache){
|
||||
this.renderer.applyFilters();
|
||||
this.renderer.postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user