diff --git a/src/ol/source/vector.js b/src/ol/source/vector.js index ee3c9ad205..e1e88b30cf 100644 --- a/src/ol/source/vector.js +++ b/src/ol/source/vector.js @@ -610,11 +610,13 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate, * * This method is not available when the source is configured with * `useSpatialIndex` set to `false`. + * @param {ol.Extent=} opt_extent Destination extent. If provided, no new extent + * will be created. Instead, that extent's coordinates will be overwritten. * @return {!ol.Extent} Extent. * @api */ -ol.source.Vector.prototype.getExtent = function() { - return this.featuresRtree_.getExtent(); +ol.source.Vector.prototype.getExtent = function(opt_extent) { + return this.featuresRtree_.getExtent(opt_extent); }; diff --git a/src/ol/structs/rbush.js b/src/ol/structs/rbush.js index c49496e3a7..0828832452 100644 --- a/src/ol/structs/rbush.js +++ b/src/ol/structs/rbush.js @@ -213,5 +213,5 @@ ol.structs.RBush.prototype.clear = function() { ol.structs.RBush.prototype.getExtent = function(opt_extent) { // FIXME add getExtent() to rbush var data = this.rbush_.data; - return [data.minX, data.minY, data.maxX, data.maxY]; + return ol.extent.createOrUpdate(data.minX, data.minY, data.maxX, data.maxY, opt_extent); };