Class: DragZoom

ol/interaction/DragZoom~DragZoom


import DragZoom from 'ol/interaction/DragZoom';

Allows the user to zoom the map by clicking and dragging on the map, normally combined with an module:ol/events/condition that limits it to when a key, shift by default, is held down.

To change the style of the box, use CSS and the .ol-dragzoom selector, or your custom one configured with className.

new DragZoom(opt_options)

interaction/DragZoom.js, line 33
Name Type Description
options

Options.

Name Type Default Description
className string 'ol-dragzoom'

CSS class name for styling the box.

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~shiftKeyOnly.

duration number 200

Animation duration in milliseconds.

out boolean false

Use interaction for zooming out.