模块:ol/Overlay

ol/Overlay


Overlay

类型定义

Options{Object}

属性:
Name Type 描述
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它被放置在指定了CSS类名的容器中className属性。

insertFirst boolean
(defaults to true)

覆盖层是首先插入到覆盖层容器中,还是追加到末尾?如果覆盖层与控件置于同一容器中(请参阅stopEvent选项)通常需要设置insertFirsttrue因此,覆盖层显示在控件下方。

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}

属性:
Name Type 描述
animation PanOptions
(defaults to {})

平移动画参数

margin number
(defaults to 20)

平移至视图时,叠加层与地图边框之间的边距(单位:像素)。

PanOptions{Object}

属性:
Name Type 描述
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'