Skip to content

ScrollZoomHandler

The ScrollZoomHandler allows the user to zoom the map by scrolling.

Implements

Methods

disable()

disable(): void

Disables the "scroll to zoom" interaction.

Returns

void

Implementation of

Handler.disable

Example

map.scrollZoom.disable();

Source

src/ui/handler/scroll_zoom.ts:147


enable()

enable(options?: boolean | AroundCenterOptions): void

Enables the "scroll to zoom" interaction.

Parameters

Parameter Type Description
options? boolean | AroundCenterOptions Options object.

Returns

void

Implementation of

Handler.enable

Example

map.scrollZoom.enable();
map.scrollZoom.enable({ around: 'center' })

Source

src/ui/handler/scroll_zoom.ts:133


isEnabled()

isEnabled(): boolean

Returns a Boolean indicating whether the "scroll to zoom" interaction is enabled.

Returns

boolean

true if the "scroll to zoom" interaction is enabled.

Implementation of

Handler.isEnabled

Source

src/ui/handler/scroll_zoom.ts:106


setWheelZoomRate()

setWheelZoomRate(wheelZoomRate: number): void

Set the zoom rate of a mouse wheel

Parameters

Parameter Type Description
wheelZoomRate number 1/450 The rate used to scale mouse wheel movement to a zoom value.

Returns

void

Example

Slow down zoom of mouse wheel

map.scrollZoom.setWheelZoomRate(1/600);

Source

src/ui/handler/scroll_zoom.ts:98


setZoomRate()

setZoomRate(zoomRate: number): void

Set the zoom rate of a trackpad

Parameters

Parameter Type Description
zoomRate number 1/100 The rate used to scale trackpad movement to a zoom value.

Returns

void

Example

Speed up trackpad zoom

map.scrollZoom.setZoomRate(1/25);

Source

src/ui/handler/scroll_zoom.ts:85