mapbox-gl-directions icon indicating copy to clipboard operation
mapbox-gl-directions copied to clipboard

flyTo option does not work

Open szanuje opened this issue 4 years ago • 6 comments

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?

szanuje avatar Apr 21 '20 20:04 szanuje

+1 same for me

AlexKaravaev avatar Aug 28 '20 16:08 AlexKaravaev

Same

tempranova avatar Apr 14 '21 20:04 tempranova

+1

yasmanycruz79 avatar Oct 12 '21 19:10 yasmanycruz79

+1

angelc16 avatar Oct 15 '21 01:10 angelc16

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

akosaz avatar Feb 01 '22 11:02 akosaz