Problem/Motivation

On a map with a vector layer with a set of zoom levels defined, when using interactions PinchZoom, DragZoom, or MouseWheelZoom, features disappear from the map when zooming in.

Steps to reproduce

  1. Define a map with a layer based on vector source (I used Views to define the source)
  2. Add interactions to the map:
    • PinchZoom
    • DragZoom
    • MouseWheelZoom
    • KeyboardZoom
    • DoubleClickZoom
  3. On the layer, define zoom levels 13-18
  4. Open the map and try to use the mouse wheel, or draw a rectangle around area of interest to zoom into - the (initially visible) features should disappear

When using the KeyboardZoom or DoubleClickZoom interactions, zooming into the map works as intended - the features appear when entering the predefined zoom range and disappear when leaving it.

The described setup was tested on the desktop with FFox, Chrome and Safari

Issue fork openlayers-3397267

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sano created an issue. See original summary.

sano’s picture

Issue summary: View changes
sano’s picture

I suspect this issue is caused by the fact that the PinchZoom, DragZoom and MouseWheelZoom methods generate fractional zoom level values, that are not expected by the code responsible for constraining the zoom range. There might be a way around this by setting constrainResolution to true in the map constructing code. However, I do not know in what file I should look at, to set that value.

sano’s picture

..a similar, bud unfortunately unanswered report/question was made in the past by Dirkozoid.

sano’s picture

Status: Active » Needs review

Figured the correct place to fix the problem. A patch is available here.

  • sano committed 2417f48f on 7.x-3.x
    a fix for the issue #3397267
ken-g’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @sano,

I have reviewed and tested your patch. I think this is the correct change to fix the problem you identified. I have committed your change to 7.x-3.x-dev.