Class: ExtentInteraction

ol/interaction/Extent~ExtentInteraction


import ExtentInteraction from 'ol/interaction/Extent';

Allows the user to draw a vector box by clicking and dragging on the map. Once drawn, the vector box can be modified by dragging its vertices or edges. This interaction is only supported for mouse devices.

new ExtentInteraction(opt_options)

interaction/Extent.js, line 81
Name Type Description
options

Options.

Name Type Default Description
extent module:ol/extent~Extent

Initial extent. Defaults to no initial extent.

boxStyle module:ol/style/Style~StyleLike

Style for the drawn extent box. Defaults to module:ol/style/Style~createEditing()['Polygon']

pixelTolerance number 10

Pixel tolerance for considering the pointer close enough to a segment or vertex for editing.

pointerStyle module:ol/style/Style~StyleLike

Style for the cursor used to draw the extent. Defaults to module:ol/style/Style~createEditing()['Point']

wrapX boolean false

Wrap the drawn extent across multiple maps in the X direction? Only affects visuals, not functionality.

Fires:

Extends

Observable Properties

Name Type Settable ol/Object.ObjectEvent type Description
active boolean yes change:active

true if the interaction is active, false otherwise.

Methods

getExtent(){module:ol/extent~Extent}

interaction/Extent.js, line 388

Returns the current drawn extent in the view projection

Returns:
Drawn extent in the view projection.

handleEvent() inherited

interaction/Pointer.js, line 120

Handles the map browser event and may call into other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are detected.

setExtent(extent)

interaction/Extent.js, line 398

Manually sets the drawn extent, using the view projection.

Name Type Description
extent module:ol/extent~Extent

Extent