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

Preventing accidental zoom in/zoom out #1940

Closed
uhuru-be opened this issue Jan 17, 2016 · 3 comments
Closed

Preventing accidental zoom in/zoom out #1940

uhuru-be opened this issue Jan 17, 2016 · 3 comments

Comments

@uhuru-be
Copy link

A map is shown on the left side of my website. When a user scrolls down the website and moves over the map, instead of scrolling down the website, the map is zoomed in (or out). Can I prevent the map to listen to mouse scrolls ?

I know there 's an option "interactive" that you can set to false and pass to the Map instance, but this disables all mouse and keyboard listeners. I just want to disable listening to the mouse scrolling.

maybe related to #1832

@lucaswoj
Copy link
Contributor

It's not well documented (#1497) but you can disable zooming with the mouse wheel by calling

map.scrollZoom.disable()

@lucaswoj
Copy link
Contributor

Should we try to avoid responding to scroll events if the mouse pointer isn't over the map? My intuition is that's a little too "magic" to belong in mapbox-gl-js core.

@uhuru-be
Copy link
Author

Thank you lucas !
Regarding your latest comment, I think this is indeed out of the scope of mapbox-gl-js core and could/would cause unwanted behaviour.

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