Class: KeyboardPan

ol/interaction/KeyboardPan~KeyboardPan


import KeyboardPan from 'ol/interaction/KeyboardPan';

Allows the user to pan the map using keyboard arrows. Note that, although this interaction is by default included in maps, the keys can only be used when browser focus is on the element to which the keyboard events are attached. By default, this is the map div, though you can change this with the keyboardEventTarget in module:ol/Map~Map. document never loses focus but, for any other element, focus will have to be on, and returned to, this element if the keys are to function. See also module:ol/interaction/KeyboardZoom~KeyboardZoom.

new KeyboardPan(opt_options)

interaction/KeyboardPan.js, line 37
Name Type Description
options

Options.

Name Type Default Description
condition module:ol/events/condition~Condition

A function that takes an module:ol/MapBrowserEvent~MapBrowserEvent and returns a boolean to indicate whether that event should be handled. Default is module:ol/events/condition~noModifierKeys and module:ol/events/condition~targetNotEditable.

duration number 100

Animation duration in milliseconds.

pixelDelta number 128

The amount of pixels to pan on each key press.