Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a mapboxgl.EventData option, pass to 'map.fitBounds' and 'map.flyTo' #478

Open
Marvosg opened this issue Dec 1, 2022 · 0 comments
Open

Comments

@Marvosg
Copy link

Marvosg commented Dec 1, 2022

Camera move functions can have additional eventData passed to them, which is passed to event listeners of camera events ('move', 'zoom', etc)

https://docs.mapbox.com/mapbox-gl-js/api/map/#map#flyto
https://docs.mapbox.com/mapbox-gl-js/api/map/#map#fitbounds

This is useful for behaviour customization, but very useful for detecting whether a camera event was triggered by the user or programatically, as discussed here mapbox-gl-js/issues/9700

This library already has a single function that initializes all camera moves, _fly, with two usages of fitBounds and one usage of flyTo.

Adding an eventData argument (which is just a user defined object) to these invocations (as the 2nd/3rd parameter respectively) works as expected. Passing undefined as eventData works as expected, too, there is no change compared to the current behaviour and events are not modified.

The eventData could be supplied by the user through the geocoder initialization options, as well as through a function that could update it after instance creation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants