Allow to pan the map while drawing in some examples, p=jorix, r=me (closes #3271)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11969 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-05-16 07:12:03 +00:00
parent c82704905d
commit d45edfb2c0
3 changed files with 20 additions and 19 deletions

View File

@@ -85,8 +85,11 @@
<p> <p>
Use the tools to create, modify, and delete (in order from left Use the tools to create, modify, and delete (in order from left
to right) features. Use the save tool (picture of a disk) to to right) features. Use the save tool (picture of a disk) to
save your changes. Use the navigation tool (hand) to stop save your changes.
editing and use the mouse for map navigation. </p>
<p>
To deactivate "drawing" or "modifying" depress the
corresponding button.
</p> </p>
<p> <p>
See the <a href="wfs-protocol-transactions.js" target="_blank"> See the <a href="wfs-protocol-transactions.js" target="_blank">

View File

@@ -43,7 +43,8 @@ function init() {
maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508), maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508),
restrictedExtent: extent, restrictedExtent: extent,
controls: [ controls: [
new OpenLayers.Control.PanZoom() new OpenLayers.Control.PanZoom(),
new OpenLayers.Control.Navigation()
] ]
}); });
var gphy = new OpenLayers.Layer.Google( var gphy = new OpenLayers.Layer.Google(
@@ -69,12 +70,9 @@ function init() {
map.addLayers([gphy, wfs]); map.addLayers([gphy, wfs]);
var panel = new OpenLayers.Control.Panel( var panel = new OpenLayers.Control.Panel({
{'displayClass': 'customEditingToolbar'} displayClass: 'customEditingToolbar',
); allowDepress: true
var navigate = new OpenLayers.Control.Navigation({
title: "Pan Map"
}); });
var draw = new OpenLayers.Control.DrawFeature( var draw = new OpenLayers.Control.DrawFeature(
@@ -104,8 +102,7 @@ function init() {
displayClass: "olControlSaveFeatures" displayClass: "olControlSaveFeatures"
}); });
panel.addControls([navigate, save, del, edit, draw]); panel.addControls([save, del, edit, draw]);
panel.defaultControl = navigate;
map.addControl(panel); map.addControl(panel);
map.zoomToExtent(extent, true); map.zoomToExtent(extent, true);
} }

View File

@@ -107,7 +107,8 @@
projection: new OpenLayers.Projection("EPSG:900913"), projection: new OpenLayers.Projection("EPSG:900913"),
units: "m", units: "m",
controls: [ controls: [
new OpenLayers.Control.PanZoom() new OpenLayers.Control.PanZoom(),
new OpenLayers.Control.Navigation()
] ]
}); });
@@ -203,9 +204,10 @@
split.activate(); split.activate();
// add some editing tools to a panel // add some editing tools to a panel
var panel = new OpenLayers.Control.Panel( var panel = new OpenLayers.Control.Panel({
{displayClass: 'customEditingToolbar'} displayClass: 'customEditingToolbar',
); allowDepress: true
});
var draw = new OpenLayers.Control.DrawFeature( var draw = new OpenLayers.Control.DrawFeature(
wfs, OpenLayers.Handler.Path, wfs, OpenLayers.Handler.Path,
{ {
@@ -233,11 +235,9 @@
panel.addControls([ panel.addControls([
new OpenLayers.Control.Navigation(),
save, del, modify, draw save, del, modify, draw
]); ]);
panel.defaultControl = panel.controls[0];
map.addControl(panel); map.addControl(panel);
map.setCenter(new OpenLayers.LonLat(-11561460.5, 5541773), 15); map.setCenter(new OpenLayers.LonLat(-11561460.5, 5541773), 15);
} }
@@ -280,8 +280,9 @@
updating, or deleting of existing features.</p> updating, or deleting of existing features.</p>
<p>Use the tools to create, modify, and delete (in order from left <p>Use the tools to create, modify, and delete (in order from left
to right) features. Use the save tool (picture of a disk) to to right) features. Use the save tool (picture of a disk) to
save your changes. Use the navigation tool (hand) to stop editing save your changes.</p>
and use the mouse for map navigation.</p> <p>To deactivate "drawing" or "modifying" depress the corresponding
button.</p>
</div> </div>
</body> </body>