[OpenLayers-Dev] A little patch for Panel and ZoomBox

XinGang Li slinavlee at gmail.com
Tue Feb 19 02:28:40 EST 2008


Changed the order of activate/deactivate controls in the activateControl
method of the panel.

Index: lib/OpenLayers/Control/Panel.js
===================================================================
--- lib/OpenLayers/Control/Panel.js    (revision 6324)
+++ lib/OpenLayers/Control/Panel.js    (working copy)
@@ -148,14 +148,11 @@
             return;
         }
         for (var i = 0; i < this.controls.length; i++) {
-            if (this.controls[i] == control) {
-                control.activate();
-            } else {
-                if (this.controls[i].type != OpenLayers.Control.TYPE_TOGGLE)
{
-                    this.controls[i].deactivate();
-                }
+            if (this.controls[i] != control && this.controls[i].type !=
OpenLayers.Control.TYPE_TOGGLE) {
+                this.controls[i].deactivate();
             }
         }
+        control.activate();
     },

     /**
Index: lib/OpenLayers/Control/ZoomBox.js
===================================================================
--- lib/OpenLayers/Control/ZoomBox.js    (revision 6324)
+++ lib/OpenLayers/Control/ZoomBox.js    (working copy)
@@ -54,7 +54,7 @@
                 var pixHeight = Math.abs(position.top-position.bottom);
                 var zoomFactor = Math.min((this.map.size.h / pixHeight),
                     (this.map.size.w / pixWidth));
-                var extent = map.getExtent();
+                var extent = this.map.getExtent();
                 var center = this.map.getLonLatFromPixel(
                     position.getCenterPixel());
                 var xmin = center.lon - (extent.getWidth()/2)*zoomFactor;


-- 
Li XinGang
EMail: slinavlee at gmail.com
Blog:   avlee.cnblogs.com
Site:    www.mapboost.org.cn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openlayers.org/pipermail/dev/attachments/20080219/59bd23fa/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Controls.patch
Type: application/octet-stream
Size: 1533 bytes
Desc: not available
Url : http://openlayers.org/pipermail/dev/attachments/20080219/59bd23fa/attachment-0001.obj 


More information about the Dev mailing list