Two size/resize issues on singleTile layers, #886, with tests by Andreas.

Many thanks, Andreas!


git-svn-id: http://svn.openlayers.org/trunk/openlayers@3861 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-08-05 13:38:55 +00:00
parent 7361f32040
commit e3490e7aba
2 changed files with 32 additions and 4 deletions

View File

@@ -196,8 +196,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
setTileSize: function(size) {
if (this.singleTile) {
var size = this.map.getSize().clone();
size.h = size.h * this.ratio;
size.w = size.w * this.ratio;
size.h = parseInt(size.h * this.ratio);
size.w = parseInt(size.w * this.ratio);
}
OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this, [size]);
},
@@ -268,7 +268,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
var px = this.map.getLayerPxFromLonLat(ul);
if (!this.grid.length) {
this.grid[0] = [];
}
@@ -651,5 +651,18 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
}
},
/**
* Method: onMapResize
* For singleTile layers, this will replace the tile with the
* a new one with updated tileSize and extent.
*/
onMapResize: function() {
if (this.singleTile) {
this.clearGrid();
this.setTileSize();
this.initSingleTile(this.map.getExtent());
}
},
CLASS_NAME: "OpenLayers.Layer.Grid"
});