Move the temporary array to the module level
No need to create a new variable for each instance.
This commit is contained in:
@@ -73,15 +73,15 @@ const RenderFeature = function(type, flatCoordinates, ends, properties, id) {
|
|||||||
*/
|
*/
|
||||||
this.properties_ = properties;
|
this.properties_ = properties;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {ol.Transform}
|
|
||||||
*/
|
|
||||||
this.tmpTransform_ = createTransform();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {ol.Transform}
|
||||||
|
*/
|
||||||
|
const tmpTransform = createTransform();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a feature property by its key.
|
* Get a feature property by its key.
|
||||||
* @param {string} key Key
|
* @param {string} key Key
|
||||||
@@ -267,12 +267,11 @@ RenderFeature.prototype.transform = function(source, destination) {
|
|||||||
const pixelExtent = source.getExtent();
|
const pixelExtent = source.getExtent();
|
||||||
const projectedExtent = source.getWorldExtent();
|
const projectedExtent = source.getWorldExtent();
|
||||||
const scale = getHeight(projectedExtent) / getHeight(pixelExtent);
|
const scale = getHeight(projectedExtent) / getHeight(pixelExtent);
|
||||||
const transform = this.tmpTransform_;
|
composeTransform(tmpTransform,
|
||||||
composeTransform(transform,
|
|
||||||
projectedExtent[0], projectedExtent[3],
|
projectedExtent[0], projectedExtent[3],
|
||||||
scale, -scale, 0,
|
scale, -scale, 0,
|
||||||
0, 0);
|
0, 0);
|
||||||
transform2D(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2,
|
transform2D(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2,
|
||||||
transform, this.flatCoordinates_);
|
tmpTransform, this.flatCoordinates_);
|
||||||
};
|
};
|
||||||
export default RenderFeature;
|
export default RenderFeature;
|
||||||
|
|||||||
Reference in New Issue
Block a user