From 7107b8d105dcb6fa8770730c746c943312b03f54 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sat, 14 Jul 2012 15:29:36 +0200 Subject: [PATCH] Add ol.Extent.getCenter --- src/ol/extent.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ol/extent.js b/src/ol/extent.js index d6f971483b..675122050d 100644 --- a/src/ol/extent.js +++ b/src/ol/extent.js @@ -29,6 +29,15 @@ ol.Extent.prototype.clone = function() { }; +/** + * @return {goog.math.Coordinate} Center. + */ +ol.Extent.prototype.getCenter = function() { + return new goog.math.Coordinate( + (this.left + this.right) / 2, (this.top + this.bottom) / 2); +}; + + /** * @param {ol.TransformFunction} transform Transform. * @return {ol.Extent} Extent.