Create a selection handler that manages feature-state selection.
feature-state
Wires up click events on the specified layer and toggles a boolean state key (default "selected") on the underlying source. Supports single-select (default) and multi-select modes.
click
"selected"
const selection = createSelectionHandler(map, { source: "parcels", layer: "parcel-fill", onChange: (ids) => updateSidebar(ids),}); Copy
const selection = createSelectionHandler(map, { source: "parcels", layer: "parcel-fill", onChange: (ids) => updateSidebar(ids),});
Create a selection handler that manages
feature-stateselection.Wires up
clickevents on the specified layer and toggles a boolean state key (default"selected") on the underlying source. Supports single-select (default) and multi-select modes.