4

After upgrading from OpenLayers3 to OpenLayers4, the zooming has changed. Now the user can zoom to zoomlevels between integers. It does not look okay for some raster layers.

Good (same as source raster map):

source raster map

Little bit zoomed by OpenLayers (looks blurred):

enter image description here

How can I turn off this zoom option?

4

Check constrainResolution option on ol.interaction.PinchZoom http://openlayers.org/en/latest/apidoc/module-ol_interaction_PinchZoom.html

var map = new ol.Map({
    interactions: ol.interaction.defaults({}).extend([
        new ol.interaction.PinchZoom({
            constrainResolution: true
        })
    ]),
    .....
});

If you want to set for mouseWheelZoom, just change ol.interaction.PinchZoom to ol.interaction.MouseWheelZoom. plus, zoomDuration: 0 makes it no animation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.