Kevon
Kevon

Reputation: 1337

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?

Upvotes: 1

Views: 2214

Answers (2)

lebanta
lebanta

Reputation: 13

This worked for me

map.flyTo({animate:false})

Upvotes: 0

Steve Bennett
Steve Bennett

Reputation: 126697

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

Just use setFlyTo:

geocoder.setFlyTo(false);

Upvotes: -2

Related Questions