Removing logic that assumes occasionally stretched tiles
When the dom renderer included logic to stretch tiles so that gaps were properly filled for fractional zoom levels, we needed to take this into account when getting a tile coordinate for a given coordinate and resolution. This was never the proper logic for a renderer that wasn't stretching occassional tiles (e.g. the WebGL renderer, the Canvas renderer, or the new DOM renderer).
This commit is contained in:
@@ -251,28 +251,10 @@ ol.tilegrid.TileGrid.prototype.getTileCoordForCoordAndResolution = function(
|
||||
tileSize = new ol.Size(tileSize.width / scale,
|
||||
tileSize.height / scale);
|
||||
|
||||
var x, y;
|
||||
x = Math.floor(offsetFromOrigin.x / tileSize.width);
|
||||
y = Math.floor(offsetFromOrigin.y / tileSize.height);
|
||||
var x = Math.floor(offsetFromOrigin.x / tileSize.width);
|
||||
var y = Math.floor(offsetFromOrigin.y / tileSize.height);
|
||||
|
||||
var tileCoord = new ol.TileCoord(z, x, y);
|
||||
var tileCoordPixelBounds = this.getPixelBoundsForTileCoordAndResolution(
|
||||
tileCoord, resolution);
|
||||
|
||||
// adjust x to allow for stretched tiles
|
||||
if (offsetFromOrigin.x < tileCoordPixelBounds.minX) {
|
||||
tileCoord.x -= 1;
|
||||
} else if (offsetFromOrigin.x >= tileCoordPixelBounds.maxX) {
|
||||
tileCoord.x += 1;
|
||||
}
|
||||
// adjust y to allow for stretched tiles
|
||||
if (offsetFromOrigin.y < tileCoordPixelBounds.minY) {
|
||||
tileCoord.y -= 1;
|
||||
} else if (offsetFromOrigin.y >= tileCoordPixelBounds.maxY) {
|
||||
tileCoord.y += 1;
|
||||
}
|
||||
|
||||
return tileCoord;
|
||||
return new ol.TileCoord(z, x, y);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user