Methods
-
module:ol/interaction.defaults(opt_options){module:ol/Collection~Collection.<module:ol/interaction/Interaction~Interaction>}
-
import {defaults} from 'ol/interaction';
Set of interactions included in maps by default. Specific interactions can be excluded by setting the appropriate option to false in the constructor options, but the order of the interactions is fixed. If you want to specify a different order for interactions, you will need to create your own
module:ol/interaction/Interaction~Interaction
instances and insert them into amodule:ol/Collection~Collection
in the order you want before creating yourmodule:ol/Map~Map
instance. Changing the order can be of interest if the event propagation needs to be stopped at a point. The default set of interactions, in sequence, is:module:ol/interaction/DragRotate~DragRotate
module:ol/interaction/DoubleClickZoom~DoubleClickZoom
module:ol/interaction/DragPan~DragPan
module:ol/interaction/PinchRotate~PinchRotate
module:ol/interaction/PinchZoom~PinchZoom
module:ol/interaction/KeyboardPan~KeyboardPan
module:ol/interaction/KeyboardZoom~KeyboardZoom
module:ol/interaction/MouseWheelZoom~MouseWheelZoom
module:ol/interaction/DragZoom~DragZoom
Name Type Description options
Defaults options.
Name Type Description altShiftDragRotate
boolean (defaults to true) Whether Alt-Shift-drag rotate is desired.
onFocusOnly
boolean (defaults to false) Interact only when the map has the focus. This affects the
MouseWheelZoom
andDragPan
interactions and is useful when page scroll is desired for maps that do not have the browser's focus.doubleClickZoom
boolean (defaults to true) Whether double click zoom is desired.
keyboard
boolean (defaults to true) Whether keyboard interaction is desired.
mouseWheelZoom
boolean (defaults to true) Whether mousewheel zoom is desired.
shiftDragZoom
boolean (defaults to true) Whether Shift-drag zoom is desired.
dragPan
boolean (defaults to true) Whether drag pan is desired.
pinchRotate
boolean (defaults to true) Whether pinch rotate is desired.
pinchZoom
boolean (defaults to true) Whether pinch zoom is desired.
zoomDelta
number | undefined Zoom level delta when using keyboard or double click zoom.
zoomDuration
number | undefined Duration of the zoom animation in milliseconds.
Returns:
A collection of interactions to be used with themodule:ol/Map~Map
constructor'sinteractions
option.
Type Definitions
-
DefaultsOptions{Object}
-
Properties:
Name Type Argument Default Description altShiftDragRotate
boolean <optional>
true Whether Alt-Shift-drag rotate is desired.
onFocusOnly
boolean <optional>
false Interact only when the map has the focus. This affects the
MouseWheelZoom
andDragPan
interactions and is useful when page scroll is desired for maps that do not have the browser's focus.doubleClickZoom
boolean <optional>
true Whether double click zoom is desired.
keyboard
boolean <optional>
true Whether keyboard interaction is desired.
mouseWheelZoom
boolean <optional>
true Whether mousewheel zoom is desired.
shiftDragZoom
boolean <optional>
true Whether Shift-drag zoom is desired.
dragPan
boolean <optional>
true Whether drag pan is desired.
pinchRotate
boolean <optional>
true Whether pinch rotate is desired.
pinchZoom
boolean <optional>
true Whether pinch zoom is desired.
zoomDelta
number <optional>
Zoom level delta when using keyboard or double click zoom.
zoomDuration
number <optional>
Duration of the zoom animation in milliseconds.