Class: Hover

ol.interaction. Hover

Interaction hover do to something when hovering a feature


new Hover()

Parameters:
Name Type Description
olx.interaction.HoverOptions
options.cursor string | undefined

css cursor propertie or a function that gets a feature, default: none

options.featureFilter function | undefined

filter a function with two arguments, the feature and the layer of the feature. Return true to select the feature

options.layerFilter function | undefined

filter a function with one argument, the layer to test. Return true to test the layer

options.layers Array.<ol.layer> | undefined

a set of layers to test

options.hitTolerance number | undefined

Hit-detection tolerance in pixels.

options.handleEvent function | undefined

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.

Fires:
  • hover, enter,event: leave

Extends

  • ol.interaction.Interaction

Methods


handleMove_(e)

Get features whenmove

Parameters:
Name Type Description
e ol.event

"move" event


setActive(b)

Activate / deactivate interaction

Parameters:
Name Type Description
b boolean

setCursor(cursor)

Set cursor on hover

Parameters:
Name Type Description
cursor string

css cursor propertie or a function that gets a feature, default: none


setFeatureFilter(filter)

Feature filter to get only one feature

Parameters:
Name Type Description
filter function

a function with two arguments, the feature and the layer of the feature. Return true to select the feature


setLayerFilter(filter)

Feature filter to get only one feature

Parameters:
Name Type Description
filter function

a function with one argument, the layer to test. Return true to test the layer


setMap(map)

Remove the interaction from its current map, if any, and attach it to a new map, if any. Pass null to just remove the interaction from the current map.

Parameters:
Name Type Description
map ol.Map

Map.