Reputation: 21
i want to disable zooming on my leaflet map in R while having the mouse hover over it.
I tried the suspendScroll(hoverToWake = FALSE)
function from the leaflet.extras
package as well as leaflet(options = leafletOptions(scrollWheelZoom = FALSE))
, but both not working.
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. Am i the only one having this problem? My R Version is 3.6.1
Upvotes: 2
Views: 1127
Reputation: 86
If you want to disable all zooming, you can set the minZoom
and maxZoom
to the same number as the zoom
in setView
. Like this reproducible example:
map <- leaflet(options = leafletOptions(minZoom = 10, maxZoom = 10)) %>%
addTiles() %>%
setView(lng = 7.35, lat = 50.05, zoom = 10)
map
Upvotes: 3