Class: MouseWheelZoom

ol/interaction/MouseWheelZoom~MouseWheelZoom


import MouseWheelZoom from 'ol/interaction/MouseWheelZoom';

Allows the user to zoom the map by scrolling the mouse wheel.

new MouseWheelZoom(opt_options)

interaction/MouseWheelZoom.js, line 51
Name Type Description
options

Options.

Name Type Default Description
condition module:ol/events/condition~Condition

A function that takes an module:ol/MapBrowserEvent~MapBrowserEvent and returns a boolean to indicate whether that event should be handled. Default is module:ol/events/condition~always.

duration number 250

Animation duration in milliseconds.

timeout number 80

Mouse wheel timeout duration in milliseconds.

constrainResolution boolean false

When using a trackpad or magic mouse, zoom to the closest integer zoom level after the scroll gesture ends.

useAnchor boolean true

Enable zooming using the mouse's location as the anchor. When set to false, zooming in and out will zoom to the center of the screen instead of zooming on the mouse's location.

Methods

setMouseAnchor(useAnchor)

interaction/MouseWheelZoom.js, line 185

Enable or disable using the mouse's location as an anchor when zooming

Name Type Description
useAnchor boolean

true to zoom to the mouse's location, false to zoom to the center of the map