mapbox / mapbox-gl-directions

Directions plugin for mapbox-gl-js using Mapbox Directions API.
https://mapbox.com/mapbox-gl-js/example/mapbox-gl-directions/
ISC License
236 stars 123 forks source link

Initial camera animation takes only origin and destination into account #182

Open pathmapper opened 6 years ago

pathmapper commented 6 years ago

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).

camera_issue

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.

StephenStrickland commented 4 years ago

Would be great if this was fixed.