The ScrollZoomHandler allows the user to zoom the map by scrolling.
ScrollZoomHandler
Disables the "scroll to zoom" interaction.
map.scrollZoom.disable(); Copy
map.scrollZoom.disable();
Enables the "scroll to zoom" interaction.
Optional
Options object.
map.scrollZoom.enable();map.scrollZoom.enable({ around: 'center' }) Copy
map.scrollZoom.enable();map.scrollZoom.enable({ around: 'center' })
Returns a Boolean indicating whether the "scroll to zoom" interaction is enabled.
true if the "scroll to zoom" interaction is enabled.
true
Set the zoom rate of a mouse wheel
1/450 The rate used to scale mouse wheel movement to a zoom value.
Slow down zoom of mouse wheel
map.scrollZoom.setWheelZoomRate(1/600); Copy
map.scrollZoom.setWheelZoomRate(1/600);
Set the zoom rate of a trackpad
1/100 The rate used to scale trackpad movement to a zoom value.
Speed up trackpad zoom
map.scrollZoom.setZoomRate(1/25); Copy
map.scrollZoom.setZoomRate(1/25);
The
ScrollZoomHandler
allows the user to zoom the map by scrolling.