Make ol.Rectangle.intersects a member function rather than a static function
This commit is contained in:
@@ -41,19 +41,6 @@ ol.Rectangle = function(minX, minY, maxX, maxY) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Rectangle} rectangle1 Rectangle.
|
||||
* @param {ol.Rectangle} rectangle2 Rectangle.
|
||||
* @return {boolean} Intersects.
|
||||
*/
|
||||
ol.Rectangle.intersects = function(rectangle1, rectangle2) {
|
||||
return rectangle1.minX <= rectangle2.maxX &&
|
||||
rectangle1.maxX >= rectangle2.minX &&
|
||||
rectangle1.minY <= rectangle2.maxY &&
|
||||
rectangle1.maxY >= rectangle2.minY;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Rectangle} Clone.
|
||||
*/
|
||||
@@ -105,6 +92,18 @@ ol.Rectangle.prototype.getWidth = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Rectangle} rectangle Rectangle.
|
||||
* @return {boolean} Intersects.
|
||||
*/
|
||||
ol.Rectangle.prototype.intersects = function(rectangle) {
|
||||
return this.minX <= rectangle.maxX &&
|
||||
this.maxX >= rectangle.minX &&
|
||||
this.minY <= rectangle.maxY &&
|
||||
this.maxY >= rectangle.minY;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
|
||||
Reference in New Issue
Block a user