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
237 stars 123 forks source link

flyTo option does not work #244

Open szanuje opened 4 years ago

szanuje commented 4 years ago

I can't turn off map moving when I set origin and destination. I tried to set flyTo: false, but it doesn't work and map still moves to the place between point A and B. How I can just generate route, without moving the map?

AlexKaravaev commented 4 years ago

+1 same for me

tempranova commented 3 years ago

Same

yasmanycruz79 commented 2 years ago

+1

angelc16 commented 2 years ago

+1

akosaz commented 2 years ago

Hello this piece of code gets invoked, not taking into account the flyTo option https://github.com/mapbox/mapbox-gl-directions/blob/13669074cf11c6899c54fc1b77af24b89455cb42/src/controls/inputs.js#L50

it is also the reason https://github.com/mapbox/mapbox-gl-directions/blob/13669074cf11c6899c54fc1b77af24b89455cb42/src/controls/inputs.js#L52 the map gets centred on origin/destination map click.


While it may be an unorthodox solution, wrapping https://github.com/mapbox/mapbox-gl-directions/blob/13669074cf11c6899c54fc1b77af24b89455cb42/src/controls/inputs.js#L41-L53 under if (this.store.getState().flyTo) fixes the unwanted interaction

SachinthaI commented 2 months ago

Same for me

RL-William-Coates commented 1 month ago

Same for me