Optionalmode?: "put" | "add"Whether to replace or add to existing event states.
Optionalshow?: booleanWhether to show the feature after updating the event state.
The event state to set.
Can be any EventType but the drag ones: 'click', 'contextmenu', 'hover', 'hover-move' or 'long-hover'.
// Select a feature programmatically
const options: SetEventStateOptions = {
index: 0,
state: 'click',
mode: 'put', // Remove click state from other features
show: true
};
// Add hover state without affecting others
const hoverOptions: SetEventStateOptions = {
index: 2,
state: 'hover',
mode: 'add', // Keep other hover states
show: true
};
Parameters to update the event state of a feature programmatically.
Use it for: