Clone the geometry before applying the decimals transform

We may only do it if the geometry has not been previously transformed.
This commit is contained in:
Thomas Chandelle
2017-06-08 11:55:46 +02:00
parent 9691130b83
commit aface2f43e
2 changed files with 5 additions and 0 deletions

View File

@@ -206,6 +206,9 @@ ol.format.Feature.transformWithOptions = function(
if (Array.isArray(transformed)) {
transform(transformed);
} else {
if (transformed === geometry) {
transformed = transformed.clone();
}
transformed.applyTransform(transform);
}
}

View File

@@ -826,6 +826,8 @@ describe('ol.format.GeoJSON', function() {
});
expect(format.readGeometry(geojson).getCoordinates()).to.eql(
[[42.123457, 38.987654], [43, 39]]);
expect(linestring.getCoordinates()).to.eql(
[[42.123456789, 38.987654321], [43, 39]]);
});
});