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 82
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~Style | Array.<module:ol/style/Style~Style> | module:ol/style/Style~StyleFunction

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~Style | Array.<module:ol/style/Style~Style> | module:ol/style/Style~StyleFunction

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:
  • Event

Methods

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

interaction/Extent.js, line 295

Returns the current drawn extent in the view projection

Returns:
Drawn extent in the view projection.

setExtent(extent)

interaction/Extent.js, line 305

Manually sets the drawn extent, using the view projection.

Name Type Description
extent module:ol/extent~Extent

Extent