Module: ol/Overlay

ol/Overlay


Classes

Overlay

Type Definitions

Options{Object}

Properties:
Name Type Description
id number | string | undefined

设置覆盖物 ID。覆盖物 ID 可与 getOverlayById 方法一起使用。

element HTMLElement | undefined

覆盖物元素。

offset Array.<number>
(defaults to [0, 0])

定位覆盖物时使用的像素偏移量。数组中的第一个元素是水平偏移量。正值使覆盖物向右偏移。第二个元素是垂直偏移量。正值使覆盖物向下偏移。

position Coordinate | undefined

覆盖物在地图投影中的位置。

positioning Positioning
(defaults to 'top-left')

定义覆盖物相对于其 position 属性的实际定位方式。可能的值为 'bottom-left''bottom-center''bottom-right''center-left''center-center''center-right''top-left''top-center''top-right'

stopEvent boolean
(defaults to true)

是否应停止向地图视口的事件传播。如果为 true,覆盖物放置在与控件相同的容器中(CSS 类名 ol-overlaycontainer-stopevent);如果为 false,放置在由 className 属性指定 CSS 类名的容器中。

insertFirst boolean
(defaults to true)

覆盖物是否插入到覆盖物容器的前面,或追加到后面。如果覆盖物与控件放置在同一个容器中(参见 stopEvent 选项),您可能需要将 insertFirst 设置为 true,以便覆盖物显示在控件下方。

autoPan PanIntoViewOptions | boolean
(defaults to false)

调用 setPosition 时平移地图,使覆盖物在当前视口中完全可见。

className string
(defaults to 'ol-overlay-container ol-selectable')

CSS 类名。

OverlayObjectEventTypes{Types} {'change:element'} {'change:map'} {'change:offset'} {'change:position'} {'change:positioning'}

PanIntoViewOptions{Object}

Properties:
Name Type Description
animation PanOptions
(defaults to {})

平移的动画参数

margin number
(defaults to 20)

平移到视图中时覆盖物与地图边界之间的边距(像素)。

PanOptions{Object}

Properties:
Name Type Description
duration number
(defaults to 1000)

动画的持续时间(毫秒)。

easing function | undefined

要使用的缓动函数。可以是 ol/easing 中的一个或自定义函数。默认为 inAndOut

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

覆盖物位置:'bottom-left''bottom-center''bottom-right''center-left''center-center''center-right''top-left''top-center''top-right'