Don't rely on the bounds of the top-right tile.
When the grid crosses the dateline, the top-right tile is in a different world than the bottom-left one. Instead, use the grid size and tile width/height to calculate the top-right coordinate.
This commit is contained in:
@@ -583,18 +583,16 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
|||||||
getTilesBounds: function() {
|
getTilesBounds: function() {
|
||||||
var bounds = null;
|
var bounds = null;
|
||||||
|
|
||||||
if (this.grid.length) {
|
var length = this.grid.length;
|
||||||
var bottom = this.grid.length - 1;
|
if (length) {
|
||||||
var bottomLeftTile = this.grid[bottom][0];
|
var bottomLeftTileBounds = this.grid[length - 1][0].bounds,
|
||||||
|
width = this.grid[0].length * bottomLeftTileBounds.getWidth(),
|
||||||
var right = this.grid[0].length - 1;
|
height = this.grid.length * bottomLeftTileBounds.getHeight();
|
||||||
var topRightTile = this.grid[0][right];
|
|
||||||
|
|
||||||
bounds = new OpenLayers.Bounds(bottomLeftTile.bounds.left,
|
|
||||||
bottomLeftTile.bounds.bottom,
|
|
||||||
topRightTile.bounds.right,
|
|
||||||
topRightTile.bounds.top);
|
|
||||||
|
|
||||||
|
bounds = new OpenLayers.Bounds(bottomLeftTileBounds.left,
|
||||||
|
bottomLeftTileBounds.bottom,
|
||||||
|
bottomLeftTileBounds.left + width,
|
||||||
|
bottomLeftTileBounds.bottom + height);
|
||||||
}
|
}
|
||||||
return bounds;
|
return bounds;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user