Class: Translate

ol/interaction/Translate~Translate


import Translate from 'ol/interaction/Translate';

Interaction for translating (moving) features.

new Translate(opt_options)

interaction/Translate.js, line 96
Name Type Description
options

Options.

Name Type Default Description
features module:ol/Collection~Collection.<module:ol/Feature~Feature>

Only features contained in this collection will be able to be translated. If not specified, all features on the map will be able to be translated.

layers Array.<module:ol/layer/Layer~Layer> | function

A list of layers from which features should be translated. Alternatively, a filter function can be provided. The function will be called for each layer in the map and should return true for layers that you want to be translatable. If the option is absent, all visible layers will be considered translatable.

hitTolerance number 0

Hit-detection tolerance. Pixels inside the radius around the given position will be checked for features. This only works for the canvas renderer and not for WebGL.

Fires:
  • TranslateEvent

Methods

getHitTolerance(){number}

interaction/Translate.js, line 189

Returns the Hit-detection tolerance.

Returns:
Hit tolerance in pixels.

setHitTolerance(hitTolerance)

interaction/Translate.js, line 200

Hit-detection tolerance. Pixels inside the radius around the given position will be checked for features. This only works for the canvas renderer and not for WebGL.

Name Type Description
hitTolerance number

Hit tolerance in pixels.