Namespace: interaction

olx.interaction

Type Definitions

olx.interaction.DefaultsOptions{Object} experimental

Interactions for the map. Default is true for all options.

Properties:
Name Type Argument Description
altShiftDragRotate boolean | undefined <optional>

Whether Alt-Shift-drag rotate is desired. Default is true.

doubleClickZoom boolean | undefined <optional>

Whether double click zoom is desired. Default is true.

keyboard boolean | undefined <optional>

Whether keyboard interaction is desired. Default is true.

mouseWheelZoom boolean | undefined <optional>

Whether mousewheel zoom is desired. Default is true.

shiftDragZoom boolean | undefined <optional>

Whether Shift-drag zoom is desired. Default is true.

dragPan boolean | undefined <optional>

Whether drag pan is desired. Default is true.

pinchRotate boolean | undefined <optional>

Whether pinch rotate is desired. Default is true.

pinchZoom boolean | undefined <optional>

Whether pinch zoom is desired. Default is true.

zoomDelta number | undefined <optional>

Zoom delta.

zoomDuration number | undefined <optional>

Zoom duration.

olx.interaction.DoubleClickZoomOptions{Object} experimental

Properties:
Name Type Argument Description
duration number | undefined <optional>

Animation duration in milliseconds. Default is 250.

delta number | undefined <optional>

The zoom delta applied on each double click, default is 1.

olx.interaction.DragAndDropOptions{Object} experimental

Properties:
Name Type Argument Description
formatConstructors Array.<function(new:ol.format.Feature)> | undefined <optional>

Format constructors.

projection ol.proj.ProjectionLike

Target projection. By default, the map's view's projection is used.

olx.interaction.DragBoxOptions{Object} experimental

Properties:
Name Type Argument Description
condition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. Default is ol.events.condition.always.

style ol.style.Style

Style for the box.

olx.interaction.DragPanOptions{Object} experimental

Properties:
Name Type Argument Description
kinetic ol.Kinetic | undefined <optional>

Kinetic inertia to apply to the pan.

olx.interaction.DragRotateAndZoomOptions{Object} experimental

Properties:
Name Type Argument Description
condition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. Default is ol.events.condition.shiftKeyOnly.

duration number | undefined <optional>

Animation duration in milliseconds. Default is 400.

olx.interaction.DragRotateOptions{Object} experimental

Properties:
Name Type Argument Description
condition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. Default is ol.events.condition.altShiftKeysOnly.

duration number | undefined <optional>

Animation duration in milliseconds. Default is 250.

olx.interaction.DragZoomOptions{Object} experimental

Properties:
Name Type Argument Description
condition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. Default is ol.events.condition.shiftKeyOnly.

duration number | undefined <optional>

Animation duration in milliseconds. Default is 200.

style ol.style.Style

Style for the box.

olx.interaction.DrawOptions{Object} experimental

Properties:
Name Type Argument Description
features ol.Collection.<ol.Feature> | undefined <optional>

Destination collection for the drawn features.

source ol.source.Vector | undefined <optional>

Destination source for the drawn features.

snapTolerance number | undefined <optional>

Pixel distance for snapping to the drawing finish. Default is 12.

type ol.geom.GeometryType

Drawing type ('Point', 'LineString', 'Polygon', 'MultiPoint', 'MultiLineString', 'MultiPolygon' or 'Circle').

maxPoints number | undefined <optional>

The number of points that can be drawn before a polygon ring or line string is finished. The default is no restriction.

minPoints number | undefined <optional>

The number of points that must be drawn before a polygon ring or line string can be finished. Default is 3 for polygon rings and 2 for line strings.

style ol.style.Style | Array.<ol.style.Style> | ol.style.StyleFunction | undefined <optional>

Style for sketch features.

geometryFunction ol.interaction.DrawGeometryFunctionType | undefined <optional>

Function that is called when a geometry's coordinates are updated.

geometryName string | undefined <optional>

Geometry name to use for features created by the draw interaction.

condition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. By default ol.events.condition.noModifierKeys, i.e. a click, adds a vertex or deactivates freehand drawing.

freehandCondition ol.events.ConditionType | undefined <optional>

Condition that activates freehand drawing for lines and polygons. This function takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. The default is ol.events.condition.shiftKeyOnly, meaning that the Shift key activates freehand drawing.

olx.interaction.InteractionOptions{Object} experimental

Object literal with config options for interactions.

Properties:
Name Type Description
handleEvent function

Method called by the map to notify the interaction that a browser event was dispatched to the map. The function may return false to prevent the propagation of the event to other interactions in the map's interactions chain. Required.

olx.interaction.KeyboardPanOptions{Object} experimental

Properties:
Name Type Argument Description
condition ol.events.ConditionType | undefined <optional>

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

duration number | undefined <optional>

Animation duration in milliseconds. Default is 100.

pixelDelta number | undefined <optional>

Pixel The amount to pan on each key press. Default is 128 pixels.

olx.interaction.KeyboardZoomOptions{Object} experimental

Properties:
Name Type Argument Description
duration number | undefined <optional>

Animation duration in milliseconds. Default is 100.

condition ol.events.ConditionType | undefined <optional>

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

delta number | undefined <optional>

The amount to zoom on each key press. Default is 1.

olx.interaction.ModifyOptions{Object} experimental

Properties:
Name Type Argument Description
deleteCondition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. By default, ol.events.condition.singleClick with ol.events.condition.noModifierKeys results in a vertex deletion.

pixelTolerance number | undefined <optional>

Pixel tolerance for considering the pointer close enough to a segment or vertex for editing. Default is 10.

style ol.style.Style | Array.<ol.style.Style> | ol.style.StyleFunction | undefined <optional>

FeatureOverlay style.

features ol.Collection.<ol.Feature>

The features the interaction works on.

olx.interaction.MouseWheelZoomOptions{Object} experimental

Properties:
Name Type Argument Description
duration number | undefined <optional>

Animation duration in milliseconds. Default is 250.

olx.interaction.PinchRotateOptions{Object} experimental

Properties:
Name Type Argument Description
duration number | undefined <optional>

The duration of the animation in milliseconds. Default is 250.

threshold number | undefined <optional>

Minimal angle in radians to start a rotation. Default is 0.3.

olx.interaction.PinchZoomOptions{Object} experimental

Properties:
Name Type Argument Description
duration number | undefined <optional>

Animation duration in milliseconds. Default is 400.

olx.interaction.PointerOptions{Object} experimental

Properties:
Name Type Argument Description
handleDownEvent function | undefined <optional>

Function handling "down" events. If the function returns true then a drag sequence is started.

handleDragEvent function | undefined <optional>

Function handling "drag" events. This function is called on "move" events during a drag sequence.

handleEvent function | undefined <optional>

Method called by the map to notify the interaction that a browser event was dispatched to the map. The function may return false to prevent the propagation of the event to other interactions in the map's interactions chain.

handleMoveEvent function | undefined <optional>

Function handling "move" events. This function is called on "move" events, also during a drag sequence (so during a drag sequence both the handleDragEvent function and this function are called).

handleUpEvent function | undefined <optional>

Function handling "up" events. If the function returns false then the current drag sequence is stopped.

olx.interaction.SelectOptions{Object} experimental

Properties:
Name Type Argument Description
addCondition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. By default, this is ol.events.condition.never. Use this if you want to use different events for add and remove instead of toggle.

condition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. This is the event for the selected features as a whole. By default, this is ol.events.condition.singleClick. Clicking on a feature selects that feature and removes any that were in the selection. Clicking outside any feature removes all from the selection. See toggle, add, remove options for adding/removing extra features to/ from the selection.

layers Array.<ol.layer.Layer> | function

A list of layers from which features should be selected. 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 selectable. If the option is absent, all visible layers will be considered selectable.

style ol.style.Style | Array.<ol.style.Style> | ol.style.StyleFunction | undefined <optional>

Style for the selected features (those in the FeatureOverlay).

removeCondition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. By default, this is ol.events.condition.never. Use this if you want to use different events for add and remove instead of toggle.

toggleCondition ol.events.ConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. This is in addition to the condition event. By default, ol.events.condition.shiftKeyOnly, i.e. pressing shift as well as the condition event, adds that feature to the current selection if it is not currently selected, and removes it if it is. See add and remove if you want to use different events instead of a toggle.

multi boolean | undefined <optional>

A boolean that determines if the default behaviour should select only single features or all (overlapping) features at the clicked map position. Default is false i.e single select

filter ol.interaction.SelectFilterFunction | undefined <optional>

A function that takes an ol.Feature and an ol.layer.Layer and returns true if the feature may be selected or false otherwise.

olx.interaction.SnapOptions{Object} experimental

Options for snap

Properties:
Name Type Argument Description
features ol.Collection.<ol.Feature> | undefined <optional>

Snap to these features. Either this option or source should be provided.

pixelTolerance number | undefined <optional>

Pixel tolerance for considering the pointer close enough to a segment or vertex for editing. Default is 10 pixels.

source ol.source.Vector | undefined <optional>

Snap to features from this source. Either this option or features should be provided