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

How to get current zoom level of the map? #337

Open
lymine1996 opened this issue Jul 25, 2021 · 2 comments
Open

How to get current zoom level of the map? #337

lymine1996 opened this issue Jul 25, 2021 · 2 comments

Comments

@lymine1996
Copy link

What I need to do is to deactivate the highlight function until the users reach a certain higher zoom level. So is there a getZoom() function in this library and how to apply it? I'm confused since every answer on StackOverflow is about react-mapbox-gl but I don't have time to switch the whole codebase.

@amirbashan
Copy link

You can try using the "onZoom", in the object you'll see the zoom
<ReactMapGL {...viewport} onZoom={(e) => { console.log(e.viewState.zoom); }} >

@quickshiftin
Copy link

the method you're looking for is onViewStateChange

 <ReactMapGL {...viewport} onViewStateChange={(e) => { console.log(e.viewState.zoom); }} >

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

No branches or pull requests

3 participants