Namespace: interaction

olx.interaction


Type Definitions

olx.interaction.DefaultsOptions{Object}

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.

constrainResolution boolean | undefined <optional>

Zoom to the closest integer zoom level after the wheel/trackpad or pinch gesture ends. Default is false.

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}

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}

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

Format constructors.

source ol.source.Vector | undefined <optional>

Optional vector source where features will be added. If a source is provided all existing features will be removed and new features will be added when they are dropped on the target. If you want to add features to a vector source without removing the existing features (append only), instead of providing the source option listen for the "addfeatures" event.

projection ol.ProjectionLike

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

target Element | undefined <optional>

The element that is used as the drop target, default is the viewport element.

olx.interaction.DragBoxOptions{Object}

Properties:
Name Type Argument Description
className string | undefined <optional>

CSS class name for styling the box. The default is ol-dragbox.

condition ol.EventsConditionType | 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.

minArea number | undefined <optional>

The minimum area of the box in pixel, this value is used by the default boxEndCondition function. Default is 64.

boxEndCondition ol.DragBoxEndConditionType | undefined <optional>

A function that takes a ol.MapBrowserEvent and two ol.Pixels to indicate whether a boxend event should be fired. Default is true if the area of the box is bigger than the minArea option.

olx.interaction.DragPanOptions{Object}

Properties:
Name Type Argument Description
condition ol.EventsConditionType | 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.

kinetic ol.Kinetic | undefined <optional>

Kinetic inertia to apply to the pan.

olx.interaction.DragRotateAndZoomOptions{Object}

Properties:
Name Type Argument Description
condition ol.EventsConditionType | 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}

Properties:
Name Type Argument Description
condition ol.EventsConditionType | 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}

Properties:
Name Type Argument Description
className string | undefined <optional>

CSS class name for styling the box. The default is ol-dragzoom.

condition ol.EventsConditionType | 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.

out boolean | undefined <optional>

Use interaction for zooming out. Default is false.

olx.interaction.DrawOptions{Object}

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

The maximum distance in pixels between "down" and "up" for a "up" event to be considered a "click" event and actually add a point/vertex to the geometry being drawn. Default is 6 pixels. That value was chosen for the draw interaction to behave correctly on mouse as well as on touch devices.

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'). Required.

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.

finishCondition ol.EventsConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether the drawing can be finished.

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

Style for sketch features.

geometryFunction ol.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.EventsConditionType | 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.

freehand boolean | undefined <optional>

Operate in freehand mode for lines, polygons, and circles. This makes the interaction always operate in freehand mode and takes precedence over any freehandCondition option.

freehandCondition ol.EventsConditionType | 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.

wrapX boolean | undefined <optional>

Wrap the world horizontally on the sketch overlay. Default is false.

olx.interaction.ExtentOptions{Object}

Properties:
Name Type Argument Description
extent ol.Extent | undefined <optional>

Initial extent. Defaults to no initial extent

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

Style for the drawn extent box. Defaults to ol.style.Style.createDefaultEditing()[ol.geom.GeometryType.POLYGON]

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

Style for the cursor used to draw the extent. Defaults to ol.style.Style.createDefaultEditing()[ol.geom.GeometryType.POINT]

wrapX boolean | undefined <optional>

Wrap the drawn extent across multiple maps in the X direction? Only affects visuals, not functionality. Defaults to false.

olx.interaction.InteractionOptions{Object}

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}

Properties:
Name Type Argument Description
condition ol.EventsConditionType | 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}

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

Animation duration in milliseconds. Default is 100.

condition ol.EventsConditionType | 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}

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

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event will be considered to add or move a vertex to the sketch. Default is ol.events.condition.primaryAction.

deleteCondition ol.EventsConditionType | 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.altKeyOnly results in a vertex deletion.

insertVertexCondition ol.EventsConditionType | undefined <optional>

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether a new vertex can be added to the sketch features. Default is ol.events.condition.always

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.StyleFunction | undefined <optional>

Style used for the features being modified. By default the default edit style is used (see ol.style).

source ol.source.Vector | undefined <optional>

The vector source with features to modify. If a vector source is not provided, a feature collection must be provided with the features option.

features ol.Collection.<ol.Feature> | undefined <optional>

The features the interaction works on. If a feature collection is not provided, a vector source must be provided with the source option.

wrapX boolean | undefined <optional>

Wrap the world horizontally on the sketch overlay. Default is false.

olx.interaction.MouseWheelZoomOptions{Object}

Properties:
<