Back to all examples
Feature Event States
Triangles coloured by their event state (hovered, long-hovered, recently hovered, clicked), with sliders for the long-hover delay and the recently hovered period.
A triangle turns blue under the pointer, violet once the pointer rests on it and light blue after it leaves, so a sweep leaves a trail. A clicked one stays red until another is clicked or an arrow key moves it.
events.triangles.on('click', …)makes the source interactive, and the SDK writes each feature’s state toproperties.eventState: onematchinfill-colorcolours them all.recently-hoveredlastshoverGracePeriodMSafter the pointer leaves.updateEventsConfighands both sliders to the running map, from the next hover on.getEventStatesreads the clicked triangle andsetEventStateclicks its neighbour, in the pointer’s colours.
Related examples
Interactive map labels
Click country, city and neighborhood labels on the map to show their boundaries
Playground
Places and Search
User Interaction Events
Geometry
Web
Interactive Map POIs
Click on map POIs to see their details
Places and Search
Playground
User Interaction Events
Web
Interactive roads and numbers
Base Map with interactive roads and house numbers.
Base Map
Web
Playground
User Interaction Events
Mixed User Interaction Events
Handle various map events and user interactions
Playground
Base Map
User Interaction Events
Web