fixe rendering when resolution > 1
This commit is contained in:
parent
c47d957674
commit
f55daf4886
@ -90,17 +90,17 @@
|
|||||||
|
|
||||||
var rowsPerSlot = {};
|
var rowsPerSlot = {};
|
||||||
|
|
||||||
var max = 0;
|
|
||||||
var min = 500;
|
|
||||||
var idx_max = -1;
|
|
||||||
|
|
||||||
// precache pixel positions
|
// precache pixel positions
|
||||||
for (var r = 0; r < rows.length; ++r) {
|
for (var r = 0; r < rows.length; ++r) {
|
||||||
var row = rows[r];
|
var row = rows[r];
|
||||||
if (row.x__uint8 > max) { max = row.x__uint8; idx_max = r }
|
|
||||||
min = Math.min(row.x__uint8, min)
|
|
||||||
x[r] = row.x__uint8 * this.options.resolution;
|
x[r] = row.x__uint8 * this.options.resolution;
|
||||||
y[r] = row.y__uint8 * this.options.resolution;
|
// fix value when it's in the tile EDGE
|
||||||
|
// TODO: this should be fixed in SQL query
|
||||||
|
if (row.y__uint8 === -1) {
|
||||||
|
y[r] = 0;
|
||||||
|
} else {
|
||||||
|
y[r] = row.y__uint8 * this.options.resolution;
|
||||||
|
}
|
||||||
|
|
||||||
var dates = row.dates__uint16;
|
var dates = row.dates__uint16;
|
||||||
var vals = row.vals__uint8;
|
var vals = row.vals__uint8;
|
||||||
|
@ -112,8 +112,10 @@
|
|||||||
ctx.globalCompositeOperation = this.options.blendmode;
|
ctx.globalCompositeOperation = this.options.blendmode;
|
||||||
}
|
}
|
||||||
if (this.options.cumulative && key > tile.maxDate) {
|
if (this.options.cumulative && key > tile.maxDate) {
|
||||||
|
//TODO: precache because this tile is not going to change
|
||||||
key = tile.maxDate - 1;
|
key = tile.maxDate - 1;
|
||||||
}
|
}
|
||||||
|
var tileMax = this.options.resolution * (256/this.options.resolution - 1)
|
||||||
var activePixels = tile.timeCount[key];
|
var activePixels = tile.timeCount[key];
|
||||||
if(activePixels) {
|
if(activePixels) {
|
||||||
var pixelIndex = tile.timeIndex[key];
|
var pixelIndex = tile.timeIndex[key];
|
||||||
@ -128,7 +130,7 @@
|
|||||||
//var x = tile.x[posIdx]*res - (sp.width >> 1);
|
//var x = tile.x[posIdx]*res - (sp.width >> 1);
|
||||||
//var y = (256 - res - res*tile.y[posIdx]) - (sp.height >> 1);
|
//var y = (256 - res - res*tile.y[posIdx]) - (sp.height >> 1);
|
||||||
var x = tile.x[posIdx]- (sp.width >> 1);
|
var x = tile.x[posIdx]- (sp.width >> 1);
|
||||||
var y = 255 - tile.y[posIdx]; // flip mercator
|
var y = tileMax - tile.y[posIdx]; // flip mercator
|
||||||
ctx.drawImage(sp, x, y - (sp.height >> 1));
|
ctx.drawImage(sp, x, y - (sp.height >> 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user