mapbox / mapbox/mapbox-gl-draw

Start using the Feature State API

Open
#994 2 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api feature
Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
8d 9h
Merged PRs (30d)
5

Description

Currently, GL Draw does not utilize the Feature State API. Starting to use [feature state](https://docs.mapbox.com/mapbox-gl-js/api/map/#map#setfeaturestate) would result in several benefits, such as:

* Reduced flickering, which is currently caused by moving between "hot" and "cold" layers.
* The ability to add hover effects to drawn features (as demonstrated in [this example](https://docs.mapbox.com/mapbox-gl-js/example/hover-styles/)).
* Reduced CPU usage, since `queryRenderedFeatures` would not need to be run for every mouse move.
* A potential way to pass `userProperties` to midpoints and vertices (see https://github.com/mapbox/mapbox-gl-draw/pull/964 for additional related discussion).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Feature State API documentation and the linked hover-styles example, then inspect how GL Draw currently handles hot and cold layers, mouse movement, midpoints, and vertices. Done should include adopting feature state in GL Draw while addressing the listed flickering, hover, CPU, and userProperties goals.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.