if maxResolution is "auto" calculate maxResolution based on maxExtent and map size, else calculate maxResolution based on maxExtent and tile size
This commit is contained in:
@@ -884,16 +884,6 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
props.resolutions = this.resolutionsFromScales(props.scales);
|
||||
}
|
||||
if(props.resolutions == null) {
|
||||
var maxExtent = this.maxExtent;
|
||||
if (!props.maxResolution && maxExtent) {
|
||||
// maxResolution for default grid sets assumes that at zoom
|
||||
// level zero, the whole world fits on one tile.
|
||||
var tileSize = this.tileSize || this.map.getTileSize();
|
||||
props.maxResolution = Math.max(
|
||||
maxExtent.getWidth() / tileSize.w,
|
||||
maxExtent.getHeight() / tileSize.h
|
||||
);
|
||||
}
|
||||
props.resolutions = this.calculateResolutions(props);
|
||||
}
|
||||
}
|
||||
@@ -1029,6 +1019,18 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
minResolution = Math.max(wRes, hRes);
|
||||
}
|
||||
|
||||
if(typeof maxResolution !== "number" &&
|
||||
typeof minResolution !== "number" &&
|
||||
this.maxExtent != null) {
|
||||
// maxResolution for default grid sets assumes that at zoom
|
||||
// level zero, the whole world fits on one tile.
|
||||
var tileSize = this.tileSize || this.map.getTileSize();
|
||||
maxResolution = Math.max(
|
||||
this.maxExtent.getWidth() / tileSize.w,
|
||||
this.maxExtent.getHeight() / tileSize.h
|
||||
);
|
||||
}
|
||||
|
||||
// determine numZoomLevels
|
||||
var maxZoomLevel = props.maxZoomLevel;
|
||||
var numZoomLevels = props.numZoomLevels;
|
||||
|
||||
Reference in New Issue
Block a user