mapbox / mapbox/mapbox-gl-draw

Question: is it possible to add a feature and go directly into 'live' edit mode?

Open
#960 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I can use the control just fine and pass in geoJson but I would like to not have the user need to double click to get into the 'active' draw mode. Not sure how to describe this but the mode where (using default styling), the lines are dashed and you have movable vertices.

RIght now when I load my geoJson into the draw control, I get a featureId and then I use that to do drawControl.changeMode('direct_select', { featureId: featureId }) but this shows the mode where my feature is not rendered using the orange dotted lines. I still have to double click to engage that mode...

Thank you!

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 tracing the drawControl.changeMode('direct_select', { featureId }) entry point and compare it with the double-click path that activates the dashed-line editing state. Confirm whether direct_select can enter that state directly; done means a loaded GeoJSON feature shows movable vertices and the active styling without a second user action.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.