Remember rendered revision in ol.source.ImageCanvas

This commit is contained in:
Tom Payne
2014-01-16 15:36:27 +01:00
parent a83df1ee30
commit eb3c8a8bfc

View File

@@ -35,6 +35,12 @@ ol.source.ImageCanvas = function(options) {
*/ */
this.canvas_ = null; this.canvas_ = null;
/**
* @private
* @type {number}
*/
this.renderedRevision_ = 0;
/** /**
* @private * @private
* @type {number} * @type {number}
@@ -55,6 +61,7 @@ ol.source.ImageCanvas.prototype.getImage =
var canvas = this.canvas_; var canvas = this.canvas_;
if (!goog.isNull(canvas) && if (!goog.isNull(canvas) &&
this.renderedRevision_ == this.getRevision() &&
canvas.getResolution() == resolution && canvas.getResolution() == resolution &&
canvas.getPixelRatio() == pixelRatio && canvas.getPixelRatio() == pixelRatio &&
ol.extent.containsExtent(canvas.getExtent(), extent)) { ol.extent.containsExtent(canvas.getExtent(), extent)) {
@@ -74,6 +81,7 @@ ol.source.ImageCanvas.prototype.getImage =
this.getAttributions(), canvasElement); this.getAttributions(), canvasElement);
} }
this.canvas_ = canvas; this.canvas_ = canvas;
this.renderedRevision_ = this.getRevision();
return canvas; return canvas;
}; };