From fe08a843eec3b83737d03e635b457aabe5881bfa Mon Sep 17 00:00:00 2001 From: tschaub Date: Fri, 30 Sep 2011 13:20:15 -0600 Subject: [PATCH] Don't cache newRight or newLeft while changing bounds. --- lib/OpenLayers/BaseTypes/Bounds.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/BaseTypes/Bounds.js b/lib/OpenLayers/BaseTypes/Bounds.js index 25e4a9cbde..1afc93a577 100644 --- a/lib/OpenLayers/BaseTypes/Bounds.js +++ b/lib/OpenLayers/BaseTypes/Bounds.js @@ -652,24 +652,22 @@ OpenLayers.Bounds = OpenLayers.Class({ if (maxExtent) { var width = maxExtent.getWidth(); - var newRight = newBounds.right - rightTolerance; - var newLeft = newBounds.left + leftTolerance; - //shift right? while (newBounds.left < maxExtent.left && - newRight <= maxExtent.left ) { + newBounds.right - rightTolerance <= maxExtent.left ) { newBounds = newBounds.add(width, 0); } //shift left? - while (newLeft >= maxExtent.right && + while (newBounds.left + leftTolerance >= maxExtent.right && newBounds.right > maxExtent.right ) { newBounds = newBounds.add(-width, 0); } // crosses right only? force left + var newLeft = newBounds.left + leftTolerance; if (newLeft < maxExtent.right && newLeft > maxExtent.left && - newRight > maxExtent.right) { + newBounds.right - rightTolerance > maxExtent.right) { newBounds = newBounds.add(-width, 0); } }