Also taking into account zoomOffset.

Now the meaning of getServerZoom is fully clarified, and we can get rid of some code again as well.
This commit is contained in:
ahocevar
2012-04-27 09:25:52 -04:00
committed by Tim Schaub
parent 40b4cc49e0
commit 72d1b54956
4 changed files with 10 additions and 9 deletions
+7 -6
View File
@@ -651,17 +651,18 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
/**
* Method: getServerZoom
* Return the zoom value corresponding to the best zoom supported by the server
* resolution.
* Return the zoom value corresponding to the best matching server
* resolution, taking into account <serverResolutions> and <zoomOffset>.
*
* Returns:
* {Number} The closest server supported zoom.
* {Number} The closest server supported zoom. This is not the map zoom
* level, but an index of the server's resolutions array.
*/
getServerZoom: function() {
var serverResolution = this.getServerResolution();
var resolution = this.getServerResolution();
return this.serverResolutions ?
OpenLayers.Util.indexOf(this.serverResolutions, serverResolution) :
this.map.getZoomForResolution(serverResolution);
OpenLayers.Util.indexOf(this.serverResolutions, resolution) :
this.map.getZoomForResolution(resolution) + (this.zoomOffset || 0);
},
/**