Ticket #2384 (closed bug: fixed)

Opened 4 years ago

Last modified 3 years ago

PanZoomBar slider bug winxp IE6+, firefox 3+

Reported by: sowee Owned by: crschmidt
Priority: minor Milestone: 2.9 Release
Component: Control.PanZoomBar Version: 2.8
Keywords: Cc: asoares1@…
State: Complete

Description

Once the slider has been dragged at least one time, if you click on the zoom bar to set the zoom to a specific level, the slider is sometimes misplaced.

What happens is that once a drag is made, the variable zoomStart is set and it looks like it's never set to null. When the user then clicks on the zoombar, the divClick handler is executed onMouseDown and since this method moves the slider to the zoom level clicked - under the mouse cursor -, when the user releases the mouse button the mouseup event of the slider occurs and zoomBarUp is called. However, the zoomBarUp handler executes its code if zoomStart is not null, which is always the case once a drag has been made. The code then moves the slider again depending on the cursor relative position.

My fix is to simple put "this.zoomStart = null;" just before "OpenLayers.Event.stop(evt);" in the handler "zoomBarUp". In my case, it fixes the problem.

I've noticed the same behavior on a couple of sites using OpenLayers, in particular  http://www.openstreetmap.org/.

Change History

Changed 3 years ago by bartvde

Even though this is just a one line patch, sowee do we have a CLA from you? See  http://trac.openlayers.org/wiki/HowToContribute for more info. TIA.

Changed 3 years ago by bartvde

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

(In [10106]) fix bug in panzoombar slider, p=sowee, r=me (closes #2384)

Note: See TracTickets for help on using tickets.