mapbox / mapbox/mapbox-gl-draw

activate point feature when set point to draw tool by draw.add and draw.changeMode

Open
#1,207 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

**mapbox-gl-js version**:
1.11.1
**mapbox-gl-draw version**:
1.2.0
### Steps to Trigger Behavior
i have features and want to edit them:
const featureIds = this.draw.add(geoInsight);
this.draw.setFeatureProperty(featureIds[0], 'myFillColorProperty', this.geoInsight.color);
this.draw.setFeatureProperty(featureIds[0], 'draw_type', this.geoInsight.geometricType);
this.draw.changeMode((this.geoInsight.geometricType === GeometryType.POINT ? 'simple_select' : 'direct_select'), { featureId: featureIds[0] });

as you seemed in type point i use simple_select mode as in docs: https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/API.md#direct_select

### Expected Behavior
i want point to be activate like put feature in draw tool by direct_select,
and emit draw.selectionchange when clickoutside selected point.

### Actual Behavior
set point by simple_select and currently draw.selectionchange not emit when clickoutside selected point....

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 reproducing the provided draw.add and draw.changeMode sequence with a point, comparing simple_select with direct_select behavior. Inspect the simple_select and direct_select mode entry points and selectionchange handling; done means the point is activated as expected and clicking outside emits draw.selectionchange.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
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.