Module: ol/Overlay

ol/Overlay


Classes

Overlay

Type Definitions

Options{Object}

Properties:
Name Type Argument Default Description
id number | string <optional>

Set the overlay id. The overlay id can be used with the module:ol/Map~Map#getOverlayById method.

element HTMLElement <optional>

The overlay element.

offset Array.<number> <optional>
[0, 0]

Offsets in pixels used when positioning the overlay. The first element in the array is the horizontal offset. A positive value shifts the overlay right. The second element in the array is the vertical offset. A positive value shifts the overlay down.

position module:ol/coordinate~Coordinate <optional>

The overlay position in map projection.

positioning module:ol/Overlay~Positioning <optional>
'top-left'

Defines how the overlay is actually positioned with respect to its position property. Possible values are 'bottom-left', 'bottom-center', 'bottom-right', 'center-left', 'center-center', 'center-right', 'top-left', 'top-center', and 'top-right'.

stopEvent boolean <optional>
true

Whether event propagation to the map viewport should be stopped. If true the overlay is placed in the same container as that of the controls (CSS class name ol-overlaycontainer-stopevent); if false it is placed in the container with CSS class name specified by the className property.

insertFirst boolean <optional>
true

Whether the overlay is inserted first in the overlay container, or appended. If the overlay is placed in the same container as that of the controls (see the stopEvent option) you will probably set insertFirst to true so the overlay is displayed below the controls.

autoPan module:ol/Overlay~PanIntoViewOptions | boolean <optional>
false

Pan the map when calling setPosition, so that the overlay is entirely visible in the current viewport? If true (deprecated), then autoPanAnimation and autoPanMargin will be used to determine the panning parameters; if an object is supplied then other parameters are ignored.

autoPanAnimation module:ol/Overlay~PanOptions <optional>

The animation options used to pan the overlay into view. This animation is only used when autoPan is enabled. A duration and easing may be provided to customize the animation. Deprecated and ignored if autoPan is supplied as an object.

autoPanMargin number <optional>
20

The margin (in pixels) between the overlay and the borders of the map when autopanning. Deprecated and ignored if autoPan is supplied as an object.

autoPanOptions module:ol/Overlay~PanIntoViewOptions <optional>

The options to use for the autoPan. This is only used when autoPan is enabled and has preference over the individual autoPanMargin and autoPanOptions.

className string <optional>
'ol-overlay-container ol-selectable'

CSS class name.

OverlayObjectEventTypes{module:ol/ObjectEventType~Types} {'change:element'} {'change:map'} {'change:offset'} {'change:position'} {'change:positioning'}

PanIntoViewOptions{Object}

Properties:
Name Type Argument Default Description
animation module:ol/Overlay~PanOptions <optional>
{}

The animation parameters for the pan

margin number <optional>
20

The margin (in pixels) between the overlay and the borders of the map when panning into view.

PanOptions{Object}

Properties:
Name Type Argument Default Description
duration number <optional>
1000

The duration of the animation in milliseconds.

easing function <optional>

The easing function to use. Can be one from module:ol/easing or a custom function. Default is module:ol/easing.inAndOut.

Positioning{'bottom-left'} {'bottom-center'} {'bottom-right'} {'center-left'} {'center-center'} {'center-right'} {'top-left'} {'top-center'} {'top-right'}

The overlay position: 'bottom-left', 'bottom-center', 'bottom-right', 'center-left', 'center-center', 'center-right', 'top-left', 'top-center', or 'top-right'.