Leaflet: Please add scrollWheelZoom Leaflet option

Created on 13 Sep 2017  Â·  4Comments  Â·  Source: rstudio/leaflet

Have you ever been scrolling in a document and when you scrolled over a Leaflet window the map zoomed in or out? This can be very annoying.

Could you please implement the scrollWheelZoom Leaflet option.

I tried

leaflet(options = leafletOptions(scrollWheelZoom = FALSE)) %>%

but this didn't work.

Many thanks,

Bill

Most helpful comment

suspendScroll is useful if version works (although seems not to be working in current version), but to permanently turn off scroll wheel (not just to prevent accident scrolls) is harder.

Can I request the feature of an option leaflet(options = leafletOptions(scrollWheelZoom = FALSE)) be included in base leaflet?

All 4 comments

Take a look at leaflet.extras::suspendScroll() function. It is designed for the exact kind of use case you mention. https://bhaskarvk.github.io/leaflet.extras/reference/sleep.html
For your case setting hoverToWake=FALSE will prevent the map from activating as you scroll and will require a click or a tap (on mobile devices) to be able to interact w/ the map.

Bhaskar,

Many thanks for the terrific work you are doing with leaflet.extras!

Bill

On Sep 13, 2017, at 7:03 AM, Bhaskar V. Karambelkar notifications@github.com wrote:

Take a look at leaflet.extras:: suspendScroll() function. It is designed for the exact kind of use case you mention. https://bhaskarvk.github.io/leaflet.extras/reference/sleep.html https://bhaskarvk.github.io/leaflet.extras/reference/sleep.html
For your case setting hoverToWake=FALSE will prevent the map from activating as you scroll and will require a click or a tap (on mobile devices) to be able to interact w/ the map.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/rstudio/leaflet/issues/464#issuecomment-329177223, or mute the thread https://github.com/notifications/unsubscribe-auth/APMYaSKLZySLw7LjBTxE0OYBrsMIUMU0ks5sh-AwgaJpZM4PVZVo.

Hi Bhaskar,

i discovered that the suspendScroll(hoverToWake = FALSE) option is not working anymore in the latest R and leaflet package version.

For example:
leaflet(width = "100%") %>%
setView(0, 0, 1) %>%
addTiles() %>%
suspendScroll(hoverToWake = FALSE)

The map is still zooming in and out when i hover the mouse over it and start scrolling. Is there a possibility that you could fix this feature again? That would be perfect.

Thank you,
Viktoria

suspendScroll is useful if version works (although seems not to be working in current version), but to permanently turn off scroll wheel (not just to prevent accident scrolls) is harder.

Can I request the feature of an option leaflet(options = leafletOptions(scrollWheelZoom = FALSE)) be included in base leaflet?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mstrimas picture mstrimas  Â·  3Comments

tim-salabim picture tim-salabim  Â·  4Comments

jz1584 picture jz1584  Â·  3Comments

okjed picture okjed  Â·  6Comments

rickwol picture rickwol  Â·  3Comments