Refine getSize in terms of getWidth and getHeight

This commit is contained in:
Tom Payne
2012-07-17 23:49:47 +02:00
parent db59dfd5a2
commit fad873d44c
2 changed files with 29 additions and 5 deletions

View File

@@ -81,9 +81,25 @@ ol.Rectangle.prototype.getCenter = function() {
};
/**
* @return {number} Height.
*/
ol.Rectangle.prototype.getHeight = function() {
return this.maxY - this.minY;
};
/**
* @return {goog.math.Size} Size.
*/
ol.Rectangle.prototype.getSize = function() {
return new goog.math.Size(this.maxX - this.minX, this.maxY - this.minY);
return new goog.math.Size(this.getWidth(), this.getHeight());
};
/**
* @return {number} Width.
*/
ol.Rectangle.prototype.getWidth = function() {
return this.maxX - this.minX;
};

View File

@@ -76,9 +76,17 @@ ol.TileBounds.prototype.forEachTileCoord = function(z, f, opt_obj) {
/**
* @override
* @return {goog.math.Size} Size.
* @return {number} Height.
*/
ol.TileBounds.prototype.getSize = function() {
return new goog.math.Size(
this.maxX - this.minX + 1, this.maxY - this.minY + 1);
ol.TileBounds.prototype.getHeight = function() {
return this.maxY - this.minY + 1;
};
/**
* @override
* @return {number} Width.
*/
ol.TileBounds.prototype.getWidth = function() {
return this.maxX - this.minX + 1;
};