Allow replaying with null transform

This commit is contained in:
Andreas Hocevar
2017-01-11 17:13:28 +01:00
parent 2296ca3942
commit a671687133
2 changed files with 9 additions and 6 deletions

View File

@@ -89,7 +89,7 @@ ol.render.canvas.Replay = function(tolerance, maxExtent, resolution, overlaps) {
/**
* @private
* @type {ol.Transform}
* @type {!ol.Transform}
*/
this.renderedTransform_ = ol.transform.create();
@@ -103,17 +103,17 @@ ol.render.canvas.Replay = function(tolerance, maxExtent, resolution, overlaps) {
* @private
* @type {Array.<number>}
*/
this.pixelCoordinates_ = [];
this.pixelCoordinates_ = null;
/**
* @private
* @type {ol.Transform}
* @type {!ol.Transform}
*/
this.tmpLocalTransform_ = ol.transform.create();
/**
* @private
* @type {ol.Transform}
* @type {!ol.Transform}
*/
this.resetTransform_ = ol.transform.create();
};
@@ -229,9 +229,12 @@ ol.render.canvas.Replay.prototype.replay_ = function(
instructions, featureCallback, opt_hitExtent) {
/** @type {Array.<number>} */
var pixelCoordinates;
if (ol.array.equals(transform, this.renderedTransform_)) {
if (this.pixelCoordinates_ && ol.array.equals(transform, this.renderedTransform_)) {
pixelCoordinates = this.pixelCoordinates_;
} else {
if (!this.pixelCoordinates_) {
this.pixelCoordinates_ = [];
}
pixelCoordinates = ol.geom.flat.transform.transform2D(
this.coordinates, 0, this.coordinates.length, 2,
transform, this.pixelCoordinates_);

View File

@@ -360,7 +360,7 @@ ol.MapOptionsInternal;
/**
* An array representing an affine 2d transformation for use with
* {@link ol.transform} functions. The array has 6 elements.
* @typedef {Array.<number>}
* @typedef {!Array.<number>}
*/
ol.Transform;