Using an openlayers 3 map. I want to do drag zoom to in-between resolutions rather than to the nearest integer zoom. I can see that pinchzoom has a constrainResolution but there doesn't seem to be anything on dragzoom. Openlayers 2 seemed to have a fractionalzoom that did what I want, can I get the same effect in openlayers 3?

1 Answer 1


If you upgrade to OpenLayers >= v3.20.0, pinch and wheel zoom use fractional target zoom levels by default. Integer zoom level are only being enforced for +/- and drag zooming.

For drag zooming, it should now be easy to implement a constrainResolution option, but it has not been done. Creating a feature request ticket on https://github.com/openlayers/openlayers might help.

  • Hi, thanks for answering I'm using 3.20.1 but my dragbox doesn't zoom in unless I select less than half the area.
    – dibs487
    Jan 20, 2017 at 11:44
  • @dibs487 I had misunderstood your question. Just updated the answer. You are right that drag zoom currently has no option to do unrestricted zooming.
    – ahocevar
    Jan 21, 2017 at 12:44
  • this is the answer, its not the one I was looking for but it is right. Thanks.
    – dibs487
    Jan 26, 2017 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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