Make ol.Rectangle.intersects a member function rather than a static function

This commit is contained in:
Tom Payne
2012-07-28 01:11:09 +02:00
parent bf20ec718e
commit b59fe13242
2 changed files with 14 additions and 15 deletions

View File

@@ -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.