mapbox / mapbox/mapbox-gl-draw

Possible to bypass select+drag behavior for lineStrings?

Open
#1,035 0 comments 1 reaction 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

Hi, apologies if Github issues is the wrong place for this question/feature suggestion.

I'm currently working on a project that requires drawing and moving of lineStrings. While using direct_select to facilitate moving of the whole lineString or single Vertices, users must first click, release and then click+drag in order to move the feature.

Is it possible to implement a mode that does [this](https://docs.mapbox.com/mapbox-gl-js/example/drag-a-point/) but for lineStrings/polygons, where you can skip the selection step and simply drag whatever is under your cursor?
- If the line is dragged, drag the entire line.
- If a vertex is dragged, drag only that vertex.

To me it seems that the select -> drag behavior is a bit overkill especially for my use case where there are no overlapping lineStrings.

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

Review the existing direct_select mode and the linked Mapbox drag-a-point example first. Done means a mode supports dragging a whole LineString or an individual vertex without a prior selection step, and also covers the requested polygon behavior.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.