Add ol.TileRange#containsXY function

This commit is contained in:
Frederic Junod
2014-08-14 10:42:40 +02:00
parent 8c3a72497c
commit 14fc16b91d
3 changed files with 13 additions and 12 deletions
+11 -2
View File
@@ -89,8 +89,7 @@ ol.TileRange.createOrUpdate = function(minX, maxX, minY, maxY, tileRange) {
* @return {boolean} Contains tile coordinate.
*/
ol.TileRange.prototype.contains = function(tileCoord) {
return this.minX <= tileCoord.x && tileCoord.x <= this.maxX &&
this.minY <= tileCoord.y && tileCoord.y <= this.maxY;
return this.containsXY(tileCoord.x, tileCoord.y);
};
@@ -104,6 +103,16 @@ ol.TileRange.prototype.containsTileRange = function(tileRange) {
};
/**
* @param {number} x Tile coordinate x.
* @param {number} y Tile coordinate y.
* @return {boolean} Contains coordinate.
*/
ol.TileRange.prototype.containsXY = function(x, y) {
return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY;
};
/**
* @param {ol.TileRange} tileRange Tile range.
* @return {boolean} Equals.