[OpenLayers-Commits] r10878 - trunk/openlayers/lib/OpenLayers/Control

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Nov 8 07:26:40 EST 2010


Author: ahocevar
Date: 2010-11-08 04:26:40 -0800 (Mon, 08 Nov 2010)
New Revision: 10878

Modified:
   trunk/openlayers/lib/OpenLayers/Control/OverviewMap.js
   trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js
Log:
Fixed OverviewMap and PanZoomBar controls. The former was broken because the extent rectangle div now has to be added to the viewPortDiv instead of the div, and the latter because it uses pagePosition where it doesn't need to, with an incorrect argument. r=fredj (closes #2247)


Modified: trunk/openlayers/lib/OpenLayers/Control/OverviewMap.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/OverviewMap.js	2010-11-08 09:19:29 UTC (rev 10877)
+++ trunk/openlayers/lib/OpenLayers/Control/OverviewMap.js	2010-11-08 12:26:40 UTC (rev 10878)
@@ -157,7 +157,7 @@
             this.handlers.drag.destroy();
         }
 
-        this.mapDiv.removeChild(this.extentRectangle);
+        this.ovmap && this.ovmap.viewPortDiv.removeChild(this.extentRectangle);
         this.extentRectangle = null;
 
         if (this.rectEvents) {
@@ -229,7 +229,6 @@
         this.extentRectangle.style.position = 'absolute';
         this.extentRectangle.style.zIndex = 1000;  //HACK
         this.extentRectangle.className = this.displayClass+'ExtentRectangle';
-        this.mapDiv.appendChild(this.extentRectangle);
 
         this.element.appendChild(this.mapDiv);  
 
@@ -490,6 +489,7 @@
                         {controls: [], maxResolution: 'auto', 
                          fallThrough: false}, this.mapOptions);
         this.ovmap = new OpenLayers.Map(this.mapDiv, options);
+        this.ovmap.viewPortDiv.appendChild(this.extentRectangle);
         
         // prevent ovmap from being destroyed when the page unloads, because
         // the OverviewMap control has to do this (and does it).

Modified: trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js	2010-11-08 09:19:29 UTC (rev 10877)
+++ trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js	2010-11-08 12:26:40 UTC (rev 10878)
@@ -286,9 +286,7 @@
         if (!OpenLayers.Event.isLeftClick(evt)) {
             return;
         }
-        var y = evt.xy.y;
-        var top = OpenLayers.Util.pagePosition(evt.object)[1];
-        var levels = (y - top)/this.zoomStopHeight;
+        var levels = evt.xy.y / this.zoomStopHeight;
         if(this.forceFixedZoomLevel || !this.map.fractionalZoom) {
             levels = Math.floor(levels);
         }    



More information about the Commits mailing list