mapbox / mapbox-gl-geocoder

Geocoder control for mapbox-gl-js using Mapbox Geocoding API
https://mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder/
ISC License
362 stars 181 forks source link

Respect marker and flyTo options when geolocating #462

Open raws opened 2 years ago

raws commented 2 years ago

I noticed that the geolocation feature (added in #444) adds a marker to the map and flies the map to the new location, even if the marker and flyTo options are set to false. This PR changes that behavior to be consistent with query(). I also performed some minor cleanup on some of the related tests, and removed some hanging whitespace.

I considered further DRYing those option checks and moving them into _handleMarker() and _fly(), but decided to keep that a concern of the caller, rather than those functions themselves. I don't feel strongly about it either way, though.