mapbox / mapbox/mapbox-gl-directions
New waypoint created by dragging is always inserted at first postion in waypoint array
Nobody has claimed this yet.
- 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:

**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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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