mapbox / mapbox/mapbox-gl-draw
Feature Request: Expose mouseenter and mouseleave for draw layers
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 5
Description
In order to take advantage of the new(ish) Mapbox setFeatureState functionality to create a hover effect, it would be nice to have exposed 'mouseenter' and 'mouseleave' events for each of the layers. This would remove the need to constantly be running queryRenderedFeatures in the background (which also requires a knowledge of the selection mode for that each feature is in).
These methods could then be exposed in the API as:
draw.mouseenter and draw.mouseleave
This could resolve: #809, #318 and more
@mcwhittemore How difficult would it be to expose these events?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the public draw API and the existing layer event handling described in the issue, including the current queryRenderedFeatures approach. Done means exposing draw.mouseenter and draw.mouseleave events for draw layers so hover effects can use setFeatureState without continuously querying rendered features.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100