Skip to content

Commit

Permalink
Fix ol.tilegrid.TileGrid#getZForResolution
Browse files Browse the repository at this point in the history
This fixes a bug in ol.tilegrid.TileGrid#getZForResolution where this function doesn't take minZoom and maxZoom into account when selecting a zoom level for a resolution.

Fixes openlayers#2780.
  • Loading branch information
elemoine authored and procrastinatio committed Apr 9, 2015
1 parent a5a68c6 commit f3c9a30
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ol/tilegrid/tilegrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ goog.provide('ol.tilegrid.TileGrid');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.functions');
goog.require('goog.math');
goog.require('ol');
goog.require('ol.Coordinate');
goog.require('ol.TileCoord');
Expand Down Expand Up @@ -393,7 +394,8 @@ ol.tilegrid.TileGrid.prototype.getTileSize = function(z) {
* @return {number} Z.
*/
ol.tilegrid.TileGrid.prototype.getZForResolution = function(resolution) {
return ol.array.linearFindNearest(this.resolutions_, resolution, 0);
var z = ol.array.linearFindNearest(this.resolutions_, resolution, 0);
return goog.math.clamp(z, this.minZoom, this.maxZoom);
};


Expand Down

0 comments on commit f3c9a30

Please sign in to comment.