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

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Feb 24 12:34:37 EST 2011


Author: ahocevar
Date: 2011-02-24 09:34:37 -0800 (Thu, 24 Feb 2011)
New Revision: 11442

Modified:
   sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js
Log:
fixing issues with pixel position tracking, and make sure that we *always* call setCenter once at the end of a drag sequence

Modified: sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js
===================================================================
--- sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js	2011-02-24 17:26:04 UTC (rev 11441)
+++ sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js	2011-02-24 17:34:37 UTC (rev 11442)
@@ -1566,7 +1566,7 @@
             // adjust
             var newCenterPx = centerPx.add(dx, dy);
 
-            if (!newCenterPx.equals(centerPx)) {
+            if (this.centerPx || !newCenterPx.equals(centerPx)) {
                 var newCenterLonLat = this.getLonLatFromViewPortPx(newCenterPx);
                 if (options.animate) {
                     this.panTo(newCenterLonLat);
@@ -1791,12 +1791,12 @@
                 this.centerPx = null;
             }
 
+            var res = this.getResolutionForZoom(zoom);
             // (re)set the layerContainerDiv's location
             if ((zoomChanged) || (this.layerContainerOrigin == null)) {
                 this.layerContainerOrigin = this.getCachedCenter();
                 this.layerContainerDiv.style.left = "0px";
                 this.layerContainerDiv.style.top  = "0px";
-                var res = this.resolution || this.getResolutionForZoom(zoom);
                 var maxExtent = this.getMaxExtent();
                 var maxExtentCenter = maxExtent.getCenterLonLat();
                 var cachedCenter = this.getCachedCenter();
@@ -1812,7 +1812,7 @@
 
             if (zoomChanged) {
                 this.zoom = zoom;
-                this.resolution = this.getResolutionForZoom(zoom);
+                this.resolution = res;
                 // zoom level has changed, increment viewRequestID.
                 this.viewRequestID++;
             }    
@@ -1910,7 +1910,6 @@
             this.maxPx.x -= dx;
             this.minPx.y -= dy;
             this.maxPx.y -= dy;
-            this.centerPx = this.getViewPortPxFromLonLat(lonlat);
         }        
     },
 



More information about the Commits mailing list