From 05858dc9fb457af9c619fa86d379ce69b24b3ab8 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 29 Feb 2008 17:32:02 +0000 Subject: [PATCH] Changing bounds.transform so it works with non-conformal projections. r=ahocevar (closes #1407) git-svn-id: http://svn.openlayers.org/trunk/openlayers@6421 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/BaseTypes/Bounds.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/BaseTypes/Bounds.js b/lib/OpenLayers/BaseTypes/Bounds.js index f474a45d61..1bbcdd10a5 100644 --- a/lib/OpenLayers/BaseTypes/Bounds.js +++ b/lib/OpenLayers/BaseTypes/Bounds.js @@ -459,12 +459,16 @@ OpenLayers.Bounds = OpenLayers.Class({ transform: function(source, dest) { var ll = OpenLayers.Projection.transform( {'x': this.left, 'y': this.bottom}, source, dest); + var lr = OpenLayers.Projection.transform( + {'x': this.right, 'y': this.bottom}, source, dest); + var ul = OpenLayers.Projection.transform( + {'x': this.left, 'y': this.top}, source, dest); var ur = OpenLayers.Projection.transform( {'x': this.right, 'y': this.top}, source, dest); - this.left = ll.x; - this.bottom = ll.y; - this.right = ur.x; - this.top = ur.y; + this.left = Math.min(ll.x, ul.x); + this.bottom = Math.min(ll.y, lr.y); + this.right = Math.max(lr.x, ur.x); + this.top = Math.max(ul.y, ur.y); return this; },