From 81349d382be3b3e895add8e23cf1dde5266ecdec Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Wed, 6 Nov 2013 12:07:50 +0100 Subject: [PATCH] Add ol.replay.CanvasBatch#getExtent --- src/ol/replay/canvas.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ol/replay/canvas.js b/src/ol/replay/canvas.js index 135e393157..2ba254126b 100644 --- a/src/ol/replay/canvas.js +++ b/src/ol/replay/canvas.js @@ -3,6 +3,7 @@ goog.provide('ol.replay.Canvas'); goog.require('goog.array'); goog.require('goog.asserts'); goog.require('goog.vec.Mat4'); +goog.require('ol.extent'); goog.require('ol.replay'); goog.require('ol.replay.Base'); goog.require('ol.replay.Batch'); @@ -65,6 +66,12 @@ ol.replay.CanvasBatch = function(type) { */ this.path_ = []; + /** + * @private + * @type {ol.Extent} + */ + this.extent_ = ol.extent.createEmpty(); + }; goog.inherits(ol.replay.CanvasBatch, ol.replay.Batch); @@ -86,6 +93,7 @@ ol.replay.CanvasBatch.prototype.addPath = function(path, stride, close) { for (i = 0; i < m; i += stride) { this.path_[j++] = path[i]; this.path_[j++] = path[i + 1]; + ol.extent.extendXY(this.extent_, path[i], path[i + 1]); } } this.instructions_.push(/** @type {ol.replay.CanvasInstruction} */ ({ @@ -117,6 +125,14 @@ ol.replay.CanvasBatch.prototype.draw = function() { }; +/** + * @inheritDoc + */ +ol.replay.CanvasBatch.prototype.getExtent = function() { + return this.extent_; +}; + + /** * @inheritDoc */