diff --git a/examples/draw-feature.html b/examples/draw-feature.html index d292794f63..f70e9eabf3 100644 --- a/examples/draw-feature.html +++ b/examples/draw-feature.html @@ -33,18 +33,27 @@ var pointLayer = new OpenLayers.Layer.Vector("Point Layer"); var lineLayer = new OpenLayers.Layer.Vector("Line Layer"); var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer"); + var boxLayer = new OpenLayers.Layer.Vector("Box layer"); - map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer]); + map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer, boxLayer]); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.MousePosition()); drawControls = { point: new OpenLayers.Control.DrawFeature(pointLayer, - OpenLayers.Handler.Point), + OpenLayers.Handler.Point), line: new OpenLayers.Control.DrawFeature(lineLayer, - OpenLayers.Handler.Path), + OpenLayers.Handler.Path), polygon: new OpenLayers.Control.DrawFeature(polygonLayer, - OpenLayers.Handler.Polygon) + OpenLayers.Handler.Polygon), + box: new OpenLayers.Control.DrawFeature(boxLayer, + OpenLayers.Handler.RegularPolygon, { + handlerOptions: { + sides: 4, + irregular: true + } + } + ) }; for(var key in drawControls) { @@ -80,11 +89,11 @@
- Demonstrate on-screen digitizing tools for point, line, and polygon creation. + Demonstrate on-screen digitizing tools for point, line, polygon and box creation.
@@ -107,6 +116,10 @@With the polygon drawing control active, click on the map to add the points that make up your polygon. Double-click to finish drawing.
+With the box drawing control active, click in the map and drag the mouse to get a rectangle. Release + the mouse to finish.
With any drawing control active, paning the map can still be achieved. Drag the map as usual for that.
Hold down the shift key while drawing to activate freehand mode. While drawing lines or polygons