Ticket #2725 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

PanZoomBar doesn't handle forceFixedZoomLevel correct

Reported by: patzi Owned by: patzi
Priority: minor Milestone: 2.11 Release
Component: Control.PanZoomBar Version: 2.9
Keywords: FixedZoomLevel PanZoomBar Cc: marcjansen
State: Complete

Description

When setting up a map with fractionalZoom: true and a PanZoomBar control with forceFixedZoomLevel: true there seems to be a bug in the implementation. If you start at a fixed zoom level and use the zoombar slider you will get a fixed zoom level back (i.e. start from 2 move up 3 get 5). But if you start with a non fixed zoom level you will get a non fixed back (i.e. start from 2.345 move up 3 get 5.345). Maybe this is the way somebody wanted it to be, but for me it feels a bit broken. Also there is an error when you move the slider to the bottom of the bar. Then it returns a negative zoom level and can not zoom to it. In the attached patch I fixed both issues so that you will get back a fixed level and 0 as the minimum zoom level.

Attachments

2725_0.patch Download (0.7 KB) - added by patzi 3 years ago.
OpenLayers-2725-001.patch Download (5.2 KB) - added by marcjansen 2 years ago.

Change History

Changed 3 years ago by patzi

Changed 3 years ago by bartvde

  • cc marcjansen added

I think these changes make sense, also adding Marc Jansen to the cc since he originally came up with forceFixedZoomLevel IIRC.

@patzi: do we have a CLA from you already?

Changed 2 years ago by marcjansen

Changed 2 years ago by marcjansen

I could reproduce the reported behaviour and do think that this is a bug in the original implementation of the forceFixedZoomLevel.

As the original patch by patzi did not include tests, I added a new one (attachment:OpenLayers-2725-001.patch Download) with tests.

In any case, thanks for your contribution, patzi.

Thanks for any review of the patch.

Changed 2 years ago by bartvde

  • status changed from new to closed
  • state changed from Review to Complete
  • resolution set to fixed

in w r11229

Thanks to both of you for your work!

Note: See TracTickets for help on using tickets.