the default controls of the editing and navigation toolbars are not activated, p=jorix, r=me (closes #3268)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11964 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -47,7 +47,7 @@
|
|||||||
*/
|
*/
|
||||||
draw: function() {
|
draw: function() {
|
||||||
var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
|
var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
|
||||||
this.activateControl(this.controls[0]);
|
this.defaultControl = this.controls[0];
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ OpenLayers.Control.EditingToolbar = OpenLayers.Class(
|
|||||||
*/
|
*/
|
||||||
draw: function() {
|
draw: function() {
|
||||||
var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
|
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;
|
return div;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ OpenLayers.Control.NavToolbar = OpenLayers.Class(OpenLayers.Control.Panel, {
|
|||||||
*/
|
*/
|
||||||
draw: function() {
|
draw: function() {
|
||||||
var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
|
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;
|
return div;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -25,7 +25,18 @@
|
|||||||
// t.eq( control.div.style.top, "6px", "Control div top located correctly by default");
|
// 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>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<li>Control/DragFeature.html</li>
|
<li>Control/DragFeature.html</li>
|
||||||
<li>Control/DragPan.html</li>
|
<li>Control/DragPan.html</li>
|
||||||
<li>Control/DrawFeature.html</li>
|
<li>Control/DrawFeature.html</li>
|
||||||
|
<li>Control/EditingToolbar.html</li>
|
||||||
<li>Control/Geolocate.html</li>
|
<li>Control/Geolocate.html</li>
|
||||||
<li>Control/GetFeature.html</li>
|
<li>Control/GetFeature.html</li>
|
||||||
<li>Control/Graticule.html</li>
|
<li>Control/Graticule.html</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user