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
- Define a map with a layer based on vector source (I used Views to define the source)
- Add interactions to the map:
- PinchZoom
- DragZoom
- MouseWheelZoom
- KeyboardZoom
- DoubleClickZoom
- On the layer, define zoom levels 13-18
- 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
Comments
Comment #2
sano commentedComment #3
sano commentedI 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.
Comment #4
sano commented..a similar, bud unfortunately unanswered report/question was made in the past by Dirkozoid.
Comment #6
sano commentedFigured the correct place to fix the problem. A patch is available here.
Comment #8
ken-g commentedThanks @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.