From 5c6821ce71981b63ca6ff2448a873f564eb4cbe6 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 4 Mar 2013 00:31:36 +0100 Subject: [PATCH] Use more in-place transforms where possible --- src/ol/projection.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ol/projection.js b/src/ol/projection.js index 30cc5deb2c..3b87eecf49 100644 --- a/src/ol/projection.js +++ b/src/ol/projection.js @@ -501,8 +501,9 @@ ol.projection.cloneTransform = function(input, opt_output, opt_dimension) { */ ol.projection.transform = function(point, source, destination) { var transformFn = ol.projection.getTransform(source, destination); - var output = transformFn([point.x, point.y]); - return new ol.Coordinate(output[0], output[1]); + var vertex = [point.x, point.y]; + vertex = transformFn(vertex, vertex, 2); + return new ol.Coordinate(vertex[0], vertex[1]); }; @@ -516,6 +517,7 @@ ol.projection.transformWithCodes = function(point, sourceCode, destinationCode) { var transformFn = ol.projection.getTransformFromCodes( sourceCode, destinationCode); - var output = transformFn([point.x, point.y]); - return new ol.Coordinate(output[0], output[1]); + var vertex = [point.x, point.y]; + vertex = transformFn(vertex, vertex, 2); + return new ol.Coordinate(vertex[0], vertex[1]); };