Class: Hover

ol.interaction. Hover


new Hover(options, optionsfeatureFilter)

Interaction hover do to something when hovering a feature

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

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

optionsfeatureFilter 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.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


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.