mapbox / mapbox/mapbox-gl-directions
Initial camera animation takes only origin and destination into account
- 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.45.0
The initial camera animation takes only origin and destination into account, so for some cases the route is shown cropped (especially if there are also waypoints for a route).

**Example:**
http://jsbin.com/zovibagabo/1/edit?html,output
Currently the bbox is calculated like this:
https://github.com/mapbox/mapbox-gl-directions/blob/6501a8eb2b5919dee2720f9153687dc50e90fd02/src/controls/inputs.js#L38-L55
The bbox for the initial camera animation should be calculated for the whole route or at least taking additionally all waypoints (if there are any) into account.
Contributor guide
Research direction
Start in src/controls/inputs.js at the linked bbox calculation and reproduce the initial camera animation with the provided JS Bin example. Check how the route origin, destination, and waypoints contribute to the initial bounds. Done means the complete route, including waypoints, is visible rather than cropped during the initial animation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100