Add scale to ol.Rectangle

This commit is contained in:
Éric Lemoine
2013-01-29 15:41:27 +01:00
parent 35a6cac37f
commit aa9f820723
2 changed files with 24 additions and 0 deletions
+13
View File
@@ -124,3 +124,16 @@ ol.Rectangle.prototype.normalize = function(coordinate) {
ol.Rectangle.prototype.toString = function() {
return '(' + [this.minX, this.minY, this.maxX, this.maxY].join(', ') + ')';
};
/**
* @param {number} value Value.
*/
ol.Rectangle.prototype.scale = function(value) {
var deltaX = (this.getWidth() / 2.0) * (value - 1);
var deltaY = (this.getHeight() / 2.0) * (value - 1);
this.minX -= deltaX;
this.minY -= deltaY;
this.maxX += deltaX;
this.maxY += deltaY;
};