Search code examples
mapboxmapbox-gl-jsmapbox-gl

Turn off Animation on Mapbox


I have a map that has a search box. A user types an address, and presses enter. The map then zooms out, pans to wherever the target is, then zooms in again. I understand from documentation that this is default behavior and that it's commonly referred to as "Fly To".

The question is... How do you disable this? I don't need fancy animation, I just want it to quickly draw a new map at the Lat/Long chosen and set the zoom level I specify.

Can this be done?


Solution

  • I assume you're using Mapbox-GL-Geocoder.

    Just use setFlyTo:

    geocoder.setFlyTo(false);