OpenLayers OpenLayers

Ticket #333 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

Scrolled pages can mess up maps

Reported by: sderle Assigned to: sderle
Priority: major Milestone: 2.2 Release
Component: general Version:
Keywords: Cc:
State:

Description

Identify and correct the observed but not yet reproducible circumstance in which, when a page is scrolled, the map display breaks.

Change History

10/07/06 15:27:24 changed by crschmidt

Fixed by r1692.

10/07/06 18:47:56 changed by crschmidt

  • status changed from new to closed.
  • resolution set to fixed.

So, Events.getMousePosition stores a cached version of the offsets for the element. This was a speed optimization made in the early days of OpenLayers -- one of the first performance optimizations we performed. However, when the first mouse event over the map is when the page has been scrolled down, the offsets are calculated based on that. To solve this, we should adjust the offset by the scroll position when we create it.

This was hard to debug, because it was very unobvious why it was happening: The offset was only happening when the *mouse wasn't moved over the map* until the page scrolled.

What a mess. I'm glad to have it really solved.