Care with transform
Since the transform method takes an arbitrary transform function, new coordinates may not be ordered in the same way as the originals.
This commit is contained in:
@@ -94,7 +94,8 @@ ol.Extent.prototype.getTopRight = function() {
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
ol.Extent.prototype.transform = function(transformFn) {
|
||||
var min = transformFn(new ol.Coordinate(this.minX, this.minY));
|
||||
var max = transformFn(new ol.Coordinate(this.maxX, this.maxY));
|
||||
return new ol.Extent(min.x, min.y, max.x, max.y);
|
||||
var a = transformFn(new ol.Coordinate(this.minX, this.minY));
|
||||
var b = transformFn(new ol.Coordinate(this.maxX, this.maxY));
|
||||
return new ol.Extent(Math.min(a.x, b.x), Math.min(a.y, b.y),
|
||||
Math.max(a.x, b.x), Math.max(a.y, b.y));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user