Class: Interaction

ol/interaction/Interaction~Interaction


import Interaction from 'ol/interaction/Interaction';

Abstract base class; normally only used for creating subclasses and not instantiated in apps. User actions that change the state of the map. Some are similar to controls, but are not associated with a DOM element. For example, module:ol/interaction/KeyboardZoom~KeyboardZoom is functionally the same as module:ol/control/Zoom~Zoom, but triggered by a keyboard event not a button element event. Although interactions do not have a DOM element, some of them do render vectors and so are visible on the screen.

new Interaction(options)

interaction/Interaction.js, line 34
Name Type Description
options

Options.

Name Type Description
handleEvent function

Method called by the map to notify the interaction that a browser event was dispatched to the map. If the function returns a falsy value, propagation of the event to other interactions in the map's interactions chain will be prevented (this includes functions with no explicit return).

Methods

getActive(){boolean}

interaction/Interaction.js, line 62

Return whether the interaction is currently active.

Returns:
true if the interaction is active, false otherwise.

getMap(){module:ol/PluggableMap~PluggableMap}

interaction/Interaction.js, line 71

Get the map associated with this interaction.

Returns:
Map.

setActive(active)

interaction/Interaction.js, line 81

Activate or deactivate the interaction.

Name Type Description
active boolean

Active.