Add "None" to draw-features example's select
This allows to deactivate drawing entirely in the example.
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
<form class="form-inline">
|
<form class="form-inline">
|
||||||
<label>Geometry type </label>
|
<label>Geometry type </label>
|
||||||
<select id="type">
|
<select id="type">
|
||||||
|
<option value="None">None</option>
|
||||||
<option value="Point">Point</option>
|
<option value="Point">Point</option>
|
||||||
<option value="LineString">LineString</option>
|
<option value="LineString">LineString</option>
|
||||||
<option value="Polygon">Polygon</option>
|
<option value="Polygon">Polygon</option>
|
||||||
|
|||||||
@@ -49,11 +49,14 @@ var typeSelect = document.getElementById('type');
|
|||||||
|
|
||||||
var draw; // global so we can remove it later
|
var draw; // global so we can remove it later
|
||||||
function addInteraction() {
|
function addInteraction() {
|
||||||
draw = new ol.interaction.Draw({
|
var value = typeSelect.value;
|
||||||
source: source,
|
if (value !== 'None') {
|
||||||
type: /** @type {ol.geom.GeometryType} */ (typeSelect.value)
|
draw = new ol.interaction.Draw({
|
||||||
});
|
source: source,
|
||||||
map.addInteraction(draw);
|
type: /** @type {ol.geom.GeometryType} */ (value)
|
||||||
|
});
|
||||||
|
map.addInteraction(draw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user