[OpenLayers-Commits] r10834 - in trunk/openlayers: lib/OpenLayers lib/OpenLayers/Control tests/Control

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Oct 14 06:57:31 EDT 2010


Author: ahocevar
Date: 2010-10-14 03:57:31 -0700 (Thu, 14 Oct 2010)
New Revision: 10834

Modified:
   trunk/openlayers/lib/OpenLayers/Control.js
   trunk/openlayers/lib/OpenLayers/Control/Panel.js
   trunk/openlayers/tests/Control/Panel.html
Log:
partially reverted r10732 (because we don't deactivate controls on destrly) and reverted r10810 (because it is not needed any more). r=elemoine (closes #2864)


Modified: trunk/openlayers/lib/OpenLayers/Control/Panel.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/Panel.js	2010-10-14 08:26:12 UTC (rev 10833)
+++ trunk/openlayers/lib/OpenLayers/Control/Panel.js	2010-10-14 10:57:31 UTC (rev 10834)
@@ -95,7 +95,6 @@
      * APIMethod: destroy
      */
     destroy: function() {
-        this.deactivate();
         OpenLayers.Control.prototype.destroy.apply(this, arguments);
         for(var i = this.controls.length - 1 ; i >= 0; i--) {
             if(this.controls[i].events) {

Modified: trunk/openlayers/lib/OpenLayers/Control.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control.js	2010-10-14 08:26:12 UTC (rev 10833)
+++ trunk/openlayers/lib/OpenLayers/Control.js	2010-10-14 10:57:31 UTC (rev 10834)
@@ -343,10 +343,7 @@
                     this.displayClass.replace(/ /g, "") + "Active"
                 );
             }
-            // deal with the case where the control is destroyed
-            if(this.events) {
-                this.events.triggerEvent("deactivate");
-            }
+            this.events.triggerEvent("deactivate");
             return true;
         }
         return false;

Modified: trunk/openlayers/tests/Control/Panel.html
===================================================================
--- trunk/openlayers/tests/Control/Panel.html	2010-10-14 08:26:12 UTC (rev 10833)
+++ trunk/openlayers/tests/Control/Panel.html	2010-10-14 10:57:31 UTC (rev 10834)
@@ -227,8 +227,8 @@
         t.ok(!controlNoDeactive.active, "Tool control autoActivate:true is not active");
         
     }
-    function test_Control_Panel_dectivate (t) {
-        t.plan(3);
+    function test_Control_Panel_deactivate (t) {
+        t.plan(2);
         var map = new OpenLayers.Map('map');
         var control = new OpenLayers.Control();
         var panel = new OpenLayers.Control.Panel();        
@@ -239,12 +239,7 @@
         panel.deactivate();
         t.ok(panel.div.innerHTML == "", 
             "Panel is not displayed after deactivate without any active control");
-        
-        panel.activate();
-        var div = panel.div;
-        panel.destroy();
-        t.eq(panel.div, null, 
-            "Panel is not displayed after destroy without any active control");
+
         map.destroy();
     }
   </script>



More information about the Commits mailing list