Maps SDK for Web

tt.ScrollZoomHandler

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

Methods

disable( )

Disables the 'scroll to zoom' interaction.

enable([options])

Enables the 'scroll to zoom' interaction.

Example
map.scrollZoom.enable();
map.scrollZoom.enable({ around: 'center' });
Parameters
Name Description
options
Object
default:None
Object with options
options.around
String
default:None
If 'center' is passed, map will zoom around center of map

isEnabled( ): Boolean

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

Returns

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

setWheelZoomRate(wheelZoomRate)

Set the zoom rate of a mouse wheel.

Example
// Slow down mouse wheel zoom
map.scrollZoom.setWheelZoomRate(1/1000);
Parameters
Name Description
wheelZoomRate
Number
default:None
The rate used to scale mouse wheel movement to a zoom value (default 1/450).

setZoomRate(zoomRate)

Set the zoom rate of a trackpad.

Example
// Slow down trackpad zoom
map.scrollZoom.setZoomRate(1/500);
Parameters
Name Description
zoomRate
Number
default:None
The rate used to scale trackpad movement to a zoom value (default 1/100).