Module: ol/interaction/Select

ol/interaction/Select


Classes

SelectEvent
Select

Type Definitions

Filter函数()

接受 要素 并在要素可被选中时返回 true,否则返回 false 的函数。

Options{Object}

属性:
Name Type Description
addCondition Condition | undefined

接受 MapBrowserEvent 并返回布尔值以指示是否应处理该事件的函数。默认为 never。如果要使用不同的事件进行添加和移除而不是 toggle,请使用此选项。

condition Condition | undefined

接受 MapBrowserEvent 并返回布尔值以指示是否应处理该事件的函数。这是针对整体选中要素的事件。默认为 singleClick。点击要素将选中该要素并移除之前选中的要素。点击要素外部将移除所有选中。参见 toggleaddremove 选项以添加/移除额外要素到/从选中项。

layers Array<Layer> | function | undefined

应从中选择要素的图层列表。或者,可以提供过滤函数。该函数将为地图中的每个图层调用,对于希望可选择的图层应返回 true。如果未提供此选项,所有可见图层将被视为可选择。

style StyleLike | null | undefined

选中要素的样式。默认使用默认编辑样式(参见 Style)。如果此交互不应为选中要素应用任何样式更改,请设置为 null。如果设置为假值,选中要素的样式将不会更改。

removeCondition Condition | undefined

接受 MapBrowserEvent 并返回布尔值以指示是否应处理该事件的函数。默认为 never。如果要使用不同的事件进行添加和移除而不是 toggle,请使用此选项。

toggleCondition Condition | undefined

接受 MapBrowserEvent 并返回布尔值以指示是否应处理该事件的函数。这是对 condition 事件的补充。默认为 shiftKeyOnly,即按下 shift 以及 condition 事件,如果要素当前未被选中则添加到当前选中项,如果已选中则移除。如果要使用不同的事件而不是切换,请参见 addremove

multi boolean
(defaults to false)

决定默认行为是仅选择单个要素还是点击地图位置处所有(重叠)要素的布尔值。默认值 false 表示单选。

features Collection<要素> | undefined

Collection where the interaction will place selected features. Optional. If not set the interaction will create a collection. In any case the collection used by the interaction is returned by getFeatures.

filter Filter函数 | undefined

接受 要素Layer 并在要素可被选中时返回 true,否则返回 false 的函数。

hitTolerance number
(defaults to 0)

命中检测容差。将检查给定位置半径内的像素是否有要素。