sbleon
sbleon

Reputation: 1685

How can I slow all zooming in OpenLayers 3?

I built an OpenLayers 3 map. I love it, but I feel that the zooming is too fast. I can't find a way to slow it down. A longer animation duration and/or a fractional-zoom approach (zooming by less than 1 for each event) would help. How can I implement these changes?

Upvotes: 2

Views: 857

Answers (1)

Jonatas Walker
Jonatas Walker

Reputation: 14150

You can customize the duration property on ol.control.Zoom, ol.interaction.MouseWheelZoom, ol.interaction.DoubleClickZoom and ol.interaction.KeyboardZoom:

var duration = 1000; // 1 second
map.addControl(new ol.control.Zoom({
  duration: duration
}));
map.addInteraction(new ol.interaction.MouseWheelZoom({
  duration: duration
}));
map.addInteraction(new ol.interaction.DoubleClickZoom({
    duration: duration
}));
map.addInteraction(new ol.interaction.KeyboardZoom({
    duration: duration
}));

Upvotes: 3

Related Questions