getClosestLevel refinement

This commit is contained in:
Ian Gilman 2017-05-19 11:12:01 -07:00
parent 1a60238c61
commit 82b1b3e599

View File

@ -320,18 +320,20 @@ $.TileSource.prototype = {
/** /**
* @function * @function
* @returns {Number} The highest level in this tile source that can be contained in a single tile.
*/ */
getClosestLevel: function() { getClosestLevel: function() {
var i, var i,
tiles; tiles;
for( i = this.minLevel; i <= this.maxLevel; i++ ){ for (i = this.minLevel + 1; i <= this.maxLevel; i++){
tiles = this.getNumTiles( i ); tiles = this.getNumTiles(i);
if (tiles.x > 1 || tiles.y > 1) { if (tiles.x > 1 || tiles.y > 1) {
break; break;
} }
} }
return Math.max( 0, i - 1 );
return i - 1;
}, },
/** /**