1 | ---
|
2 | layout: example.html
|
3 | title: Select Features
|
4 | shortdesc: Example of using the Select interaction.
|
5 | docs: >
|
6 | Choose between <code>Single-click</code>, <code>Click</code>, <code>Hover</code> and <code>Alt+Click</code> as the event type for selection in the combobox below. When using <code>Single-click</code> or <code>Click</code> you can hold do <code>Shift</code> key to toggle the feature in the selection.</p>
|
7 | <p>Note: when <code>Single-click</code> is used double-clicks won't select features. This in contrast to <code>Click</code>, where a double-click will both select the feature and zoom the map (because of the <code>DoubleClickZoom</code> interaction). Note that <code>Single-click</code> is less responsive than <code>Click</code> because of the delay it uses to detect double-clicks.</p>
|
8 | <p>In this example, a listener is registered for the Select interaction's <code>select</code> event in order to update the selection status above.
|
9 | tags: "select, vector"
|
10 | ---
|
11 | <div id="map" class="map"></div>
|
12 | <form class="form-inline">
|
13 | <label>Action type </label>
|
14 | <select id="type" class="form-control">
|
15 | <option value="click" selected>Click</option>
|
16 | <option value="singleclick">Single-click</option>
|
17 | <option value="pointermove">Hover</option>
|
18 | <option value="altclick">Alt+Click</option>
|
19 | <option value="none">None</option>
|
20 | </select>
|
21 | <span id="status"> 0 selected features</span>
|
22 | </form>
|