Use in-place transforms where possible
This commit is contained in:
@@ -79,9 +79,10 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
||||
this.transformFn_ = ol.projection.getTransform(
|
||||
ol.projection.getFromCode('EPSG:4326'), projection);
|
||||
if (!goog.isNull(this.position_)) {
|
||||
var output = this.transformFn_([this.position_.x, this.position_.y]);
|
||||
var vertex = [this.position_.x, this.position_.y];
|
||||
vertex = this.transformFn_(vertex, vertex, 2);
|
||||
this.set(ol.GeolocationProperty.POSITION,
|
||||
new ol.Coordinate(output[0], output[1]));
|
||||
new ol.Coordinate(vertex[0], vertex[1]));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -109,9 +110,10 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
||||
this.set(ol.GeolocationProperty.HEADING, goog.isNull(coords.heading) ?
|
||||
undefined : goog.math.toRadians(coords.heading));
|
||||
this.position_ = new ol.Coordinate(coords.longitude, coords.latitude);
|
||||
var output = this.transformFn_([coords.longitude, coords.latitude]);
|
||||
var vertex = [coords.longitude, coords.latitude];
|
||||
vertex = this.transformFn_(vertex, vertex, 2);
|
||||
this.set(ol.GeolocationProperty.POSITION,
|
||||
new ol.Coordinate(output[0], output[1]));
|
||||
new ol.Coordinate(vertex[0], vertex[1]));
|
||||
this.set(ol.GeolocationProperty.SPEED,
|
||||
goog.isNull(coords.speed) ? undefined : coords.speed);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user