mapbox / mapbox/mapbox-gl-directions

New waypoint created by dragging is always inserted at first postion in waypoint array

Open
#184 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug
Dominant language
JavaScript
Stars
255
Forks
130
PR merge metrics
No merged PRs in 30d

Description

mapbox-gl-directions: v3.1.3
mapbox-gl-js: v0.44.2 (not used v0.45.0 because of https://github.com/mapbox/mapbox-gl-js/issues/6642)

A new waypoint created by dragging is always inserted at [first postion in the waypoint array](https://github.com/mapbox/mapbox-gl-directions/blob/31c7911a616a0e2e306742b30d87e33cdfd56c8f/src/directions.js#L379), which results in unexpected routing results if there is already at least one waypoint present and the drag didn't start on the first leg of the route:

![drag_issue](https://user-images.githubusercontent.com/20856381/39868132-7bc17bc4-5458-11e8-89d0-75ea26b6be79.gif)

**Example:**
http://jsbin.com/yukacocuco/edit?html,output

The position in the waypoint array should be choosen according to the leg of the route where the drag action started.

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

Inspect src/directions.js at the linked insertion point and use the JSBin example to reproduce dragging on a route with existing waypoints. Trace how the drag-start leg is identified, then verify that the new waypoint is inserted at the corresponding position instead of always at the beginning of the array.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.