Avoid creating extra ol.Size object in getPixelBoundsForTileCoordAndResolution
This commit is contained in:
@@ -137,13 +137,12 @@ ol.tilegrid.TileGrid.prototype.getPixelBoundsForTileCoordAndResolution =
|
|||||||
function(tileCoord, resolution) {
|
function(tileCoord, resolution) {
|
||||||
var scale = resolution / this.getResolution(tileCoord.z);
|
var scale = resolution / this.getResolution(tileCoord.z);
|
||||||
var tileSize = this.getTileSize(tileCoord.z);
|
var tileSize = this.getTileSize(tileCoord.z);
|
||||||
tileSize = new ol.Size(tileSize.width / scale,
|
var tileWidth = tileSize.width / scale;
|
||||||
tileSize.height / scale);
|
var tileHeight = tileSize.height / scale;
|
||||||
var minX, maxX, minY, maxY;
|
var minX = Math.round(tileCoord.x * tileWidth);
|
||||||
minX = Math.round(tileCoord.x * tileSize.width);
|
var minY = Math.round(tileCoord.y * tileHeight);
|
||||||
maxX = Math.round((tileCoord.x + 1) * tileSize.width);
|
var maxX = Math.round((tileCoord.x + 1) * tileWidth);
|
||||||
minY = Math.round(tileCoord.y * tileSize.height);
|
var maxY = Math.round((tileCoord.y + 1) * tileHeight);
|
||||||
maxY = Math.round((tileCoord.y + 1) * tileSize.height);
|
|
||||||
return new ol.PixelBounds(minX, minY, maxX, maxY);
|
return new ol.PixelBounds(minX, minY, maxX, maxY);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user