Skip to content

highlightStyleFunction

highlightStyleFunction(styleFn): StyleFunction

Defined in: src/feature-styles.ts:72

Higher-order style function that wraps another style function to add highlight capability. Applies a blue highlight stroke when the feature has shouldHighlight property set to true.

StyleFunction

The base style function to wrap

StyleFunction

A new style function that conditionally applies highlighting

const baseStyle = (feature) => new Style({ ... })
const highlightedStyle = highlightStyleFunction(baseStyle)
const layer = new VectorLayer({
style: highlightedStyle
})
// Trigger highlight
feature.set('shouldHighlight', true)