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

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue May 10 03:09:19 EDT 2011


Author: erilem
Date: 2011-05-10 00:09:17 -0700 (Tue, 10 May 2011)
New Revision: 11964

Added:
   trunk/openlayers/tests/Control/EditingToolbar.html
Modified:
   trunk/openlayers/examples/navtoolbar-alwaysZoom.html
   trunk/openlayers/lib/OpenLayers/Control/EditingToolbar.js
   trunk/openlayers/lib/OpenLayers/Control/NavToolbar.js
   trunk/openlayers/tests/Control/NavToolbar.html
   trunk/openlayers/tests/list-tests.html
Log:
the default controls of the editing and navigation toolbars are not activated, p=jorix, r=me (closes #3268)

Modified: trunk/openlayers/examples/navtoolbar-alwaysZoom.html
===================================================================
--- trunk/openlayers/examples/navtoolbar-alwaysZoom.html	2011-05-09 23:31:32 UTC (rev 11963)
+++ trunk/openlayers/examples/navtoolbar-alwaysZoom.html	2011-05-10 07:09:17 UTC (rev 11964)
@@ -47,7 +47,7 @@
 				     */
 				    draw: function() {
 				        var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
-				        this.activateControl(this.controls[0]);
+                        this.defaultControl = this.controls[0];
 				        return div;
 				    }
 				});

Modified: trunk/openlayers/lib/OpenLayers/Control/EditingToolbar.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/EditingToolbar.js	2011-05-09 23:31:32 UTC (rev 11963)
+++ trunk/openlayers/lib/OpenLayers/Control/EditingToolbar.js	2011-05-10 07:09:17 UTC (rev 11964)
@@ -55,7 +55,9 @@
      */
     draw: function() {
         var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
-        this.activateControl(this.controls[0]);
+        if (this.defaultControl === null) {
+            this.defaultControl = this.controls[0];
+        }
         return div;
     },
 

Modified: trunk/openlayers/lib/OpenLayers/Control/NavToolbar.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/NavToolbar.js	2011-05-09 23:31:32 UTC (rev 11963)
+++ trunk/openlayers/lib/OpenLayers/Control/NavToolbar.js	2011-05-10 07:09:17 UTC (rev 11964)
@@ -47,7 +47,9 @@
      */
     draw: function() {
         var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
-        this.activateControl(this.controls[0]);
+        if (this.defaultControl === null) {
+            this.defaultControl = this.controls[0];
+        }
         return div;
     },
 

Added: trunk/openlayers/tests/Control/EditingToolbar.html
===================================================================
--- trunk/openlayers/tests/Control/EditingToolbar.html	                        (rev 0)
+++ trunk/openlayers/tests/Control/EditingToolbar.html	2011-05-10 07:09:17 UTC (rev 11964)
@@ -0,0 +1,30 @@
+<html>
+<head>
+  <script src="../OLLoader.js"></script>
+  <script type="text/javascript">
+    function test_ctor_draw(t) {
+        t.plan(4);
+        var map = new OpenLayers.Map('map');
+        var vLayer = new OpenLayers.Layer.Vector();
+        map.addLayer(vLayer);
+        
+        var editingToolbar = new OpenLayers.Control.EditingToolbar(vLayer);
+        map.addControl(editingToolbar);
+        
+        t.ok(editingToolbar instanceof OpenLayers.Control.EditingToolbar,
+                "new OpenLayers.Control.EditingToolbar returns object" );
+        t.ok(editingToolbar.controls[0] instanceof OpenLayers.Control.Navigation,
+                "EditingToolbar contains Control.Navigation object" );
+        t.eq(editingToolbar.controls[0].active, true,
+                "First control is active" );
+        t.eq(editingToolbar.controls.length, 4,
+                "EditingToolbar contains 4 Controls" );
+        
+        map.destroy();
+    }
+  </script>
+</head>
+<body>
+    <div id="map" style="width: 1024px; height: 512px;"/>
+</body>
+</html>

Modified: trunk/openlayers/tests/Control/NavToolbar.html
===================================================================
--- trunk/openlayers/tests/Control/NavToolbar.html	2011-05-09 23:31:32 UTC (rev 11963)
+++ trunk/openlayers/tests/Control/NavToolbar.html	2011-05-10 07:09:17 UTC (rev 11964)
@@ -25,7 +25,18 @@
         // t.eq( control.div.style.top, "6px", "Control div top located correctly by default");
 
     }
+    
+    function test_Control_NavToolbar_defaultControl (t) {
+        t.plan( 1 );
+        var map = new OpenLayers.Map('map');
 
+        var nav = new OpenLayers.Control.NavToolbar();
+        map.addControl(nav);
+        
+        t.eq(nav.controls[0].active, true, "First control is active" );
+        
+        map.destroy();
+    }
   </script>
 </head>
 <body>

Modified: trunk/openlayers/tests/list-tests.html
===================================================================
--- trunk/openlayers/tests/list-tests.html	2011-05-09 23:31:32 UTC (rev 11963)
+++ trunk/openlayers/tests/list-tests.html	2011-05-10 07:09:17 UTC (rev 11964)
@@ -15,6 +15,7 @@
     <li>Control/DragFeature.html</li>
     <li>Control/DragPan.html</li>
     <li>Control/DrawFeature.html</li>
+    <li>Control/EditingToolbar.html</li>
     <li>Control/Geolocate.html</li>
     <li>Control/GetFeature.html</li>
     <li>Control/Graticule.html</li>



More information about the Commits mailing list