Using the cross-browser util method for array indexOf in the TileCache layer. r=crschmidt (closes #2099)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9402 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2009-05-21 14:50:43 +00:00
parent e946b0a7eb
commit 16715f41f6
2 changed files with 5 additions and 2 deletions

View File

@@ -105,7 +105,9 @@ OpenLayers.Layer.TileCache = OpenLayers.Class(OpenLayers.Layer.Grid, {
var size = this.tileSize;
var tileX = Math.round((bounds.left - bbox.left) / (res * size.w));
var tileY = Math.round((bounds.bottom - bbox.bottom) / (res * size.h));
var tileZ = this.serverResolutions != null ? this.serverResolutions.indexOf(res) : this.map.getZoom();
var tileZ = this.serverResolutions != null ?
OpenLayers.Util.indexOf(this.serverResolutions, res) :
this.map.getZoom();
/**
* Zero-pad a positive integer.
* number - {Int}

View File

@@ -159,7 +159,8 @@
layer.serverResolutions = [14,13,12,11,10];
tileurl = layer.getURL(new OpenLayers.Bounds(0,0,0,0));
level = parseInt(tileurl.split('/')[2]);
t.eq(layer.serverResolutions.indexOf(map.getResolution()), level, "Tile zoom level is correct with serverResolutions");
var gotLevel = OpenLayers.Util.indexOf(layer.serverResolutions, map.getResolution());
t.eq(gotLevel, level, "Tile zoom level is correct with serverResolutions");
map.destroy();
}