[OpenLayers-Commits] r11511 - sandbox/ahocevar/layercontainer/lib/OpenLayers

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Feb 25 10:22:54 EST 2011


Author: ahocevar
Date: 2011-02-25 07:22:50 -0800 (Fri, 25 Feb 2011)
New Revision: 11511

Modified:
   sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js
Log:
fixing wrapDateLine (see #3102)

Modified: sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js
===================================================================
--- sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js	2011-02-25 15:18:02 UTC (rev 11510)
+++ sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js	2011-02-25 15:22:50 UTC (rev 11511)
@@ -1677,10 +1677,16 @@
         var hh = this.size.h / 2;
         var x = hw + dx;
         var y = hh + dy;
-        var valid = x <= this.maxPx.x &&
-                    x >= this.minPx.x &&
-                    y <= this.maxPx.y &&
+        var valid = y <= this.maxPx.y &&
                     y >= this.minPx.y;
+        var minX, maxX;
+        if (this.baseLayer.wrapDateLine === true) {
+            minX = this.minPx.x, maxX = this.maxPx.x;
+        } else {
+            valid = valid &&
+                    x <= this.maxPx.x &&
+                    x >= this.minPx.x;
+        }
         if (this.restrictedExtent && valid) {
             valid = !(this.maxPx.x - x < hw ||
                       x - this.minPx.x < hw ||
@@ -1694,6 +1700,14 @@
                     parseInt(this.layerContainerDiv.style.left) - dx + "px";
                 this.minPx.x -= dx;
                 this.maxPx.x -= dx;
+                if (this.baseLayer.wrapDateLine === true) {
+                    if (this.maxPx.x > maxX) {
+                        this.maxPx.x -= (maxX - minX);
+                    };
+                    if (this.minPx.x < minX) {
+                        this.minPx.x += (maxX - minX);
+                    };
+                }
             }
             if (dy) {
                 this.layerContainerDiv.style.top =



More information about the Commits mailing list