OpenLayers OpenLayers

Changeset 1692

Show
Ignore:
Timestamp:
10/07/06 14:26:31 (2 years ago)
Author:
crschmidt
Message:

Almost impossible to debug. element.offsets is cached (3x speedup -- a change
made in the early days of openlayers) but the cache means that relative mouse
positions are off if your first mouse event over the map is *after* the page is
scrolled. This closes #333 , and fixes a long standing not-well understood bug.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Events.js

    r1632 r1692  
    320320        if (!this.element.offsets) { 
    321321            this.element.offsets = OpenLayers.Util.pagePosition(this.element); 
     322            this.element.offsets[0] += (document.documentElement.scrollLeft 
     323                         || document.body.scrollLeft); 
     324            this.element.offsets[1] += (document.documentElement.scrollTop 
     325                         || document.body.scrollTop); 
    322326        } 
    323327        return new OpenLayers.Pixel(