include gutter in offsets

This commit is contained in:
mike-000
2022-03-29 12:58:04 +01:00
parent 14651563b4
commit 243ba189b7
2 changed files with 17 additions and 2 deletions

View File

@@ -208,7 +208,11 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
tileCoord[2] * tileSize[1]) tileCoord[2] * tileSize[1])
); );
return this.getImageData(tile.getImage(), col, row); const gutter = Math.round(
tilePixelRatio * source.getGutterForProjection(viewState.projection)
);
return this.getImageData(tile.getImage(), col + gutter, row + gutter);
} }
return null; return null;

View File

@@ -397,8 +397,19 @@ class TileTexture extends EventTarget {
let data; let data;
const image = this.tile.getImage(); const image = this.tile.getImage();
const gutter = Math.round(this.tilePixelRatio_ * this.gutter_);
try { try {
pixelContext.drawImage(image, col, row, 1, 1, 0, 0, 1, 1); pixelContext.drawImage(
image,
col + gutter,
row + gutter,
1,
1,
0,
0,
1,
1
);
data = pixelContext.getImageData(0, 0, 1, 1).data; data = pixelContext.getImageData(0, 0, 1, 1).data;
} catch (err) { } catch (err) {
return null; return null;