Add ol.extent.containsXY
This commit is contained in:
@@ -159,8 +159,7 @@ ol.extent.closestSquaredDistanceXY = function(extent, x, y) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.extent.containsCoordinate = function(extent, coordinate) {
|
||||
return extent[0] <= coordinate[0] && coordinate[0] <= extent[2] &&
|
||||
extent[1] <= coordinate[1] && coordinate[1] <= extent[3];
|
||||
return ol.extent.containsXY(extent, coordinate[0], coordinate[1]);
|
||||
};
|
||||
|
||||
|
||||
@@ -178,6 +177,20 @@ ol.extent.containsExtent = function(extent1, extent2) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the passed coordinate is contained or on the edge of the extent.
|
||||
*
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {number} x X coordinate.
|
||||
* @param {number} y Y coordinate.
|
||||
* @return {boolean} Contains.
|
||||
* @api stable
|
||||
*/
|
||||
ol.extent.containsXY = function(extent, x, y) {
|
||||
return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the relationship between a coordinate and extent.
|
||||
* @param {ol.Extent} extent The extent.
|
||||
|
||||
Reference in New Issue
Block a user