[OpenLayers-Commits] r11706 - trunk/openlayers/lib/OpenLayers
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue Mar 15 22:52:47 EDT 2011
Author: ahocevar
Date: 2011-03-15 19:52:43 -0700 (Tue, 15 Mar 2011)
New Revision: 11706
Modified:
trunk/openlayers/lib/OpenLayers/Events.js
Log:
fixing scroll position issue on the IPhone by only clearing the mouse cache conditionally. r=erilem (closes #3132)
Modified: trunk/openlayers/lib/OpenLayers/Events.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Events.js 2011-03-14 21:05:59 UTC (rev 11705)
+++ trunk/openlayers/lib/OpenLayers/Events.js 2011-03-16 02:52:43 UTC (rev 11706)
@@ -854,7 +854,18 @@
clearMouseCache: function() {
this.element.scrolls = null;
this.element.lefttop = null;
- this.element.offsets = null;
+ // OpenLayers.Util.pagePosition needs to use
+ // element.getBoundingClientRect to correctly calculate the offsets
+ // for the iPhone, but once the page is scrolled, getBoundingClientRect
+ // returns incorrect offsets. So our best bet is to not invalidate the
+ // offsets once we have them, and hope that the page was not scrolled
+ // when we did the initial calculation.
+ if (!((document.body.scrollTop != 0 ||
+ document.body.scrollLeft != 0) &&
+ navigator.userAgent.match(/iPhone/i))) {
+ OpenLayers.Console.log("clear");
+ this.element.offsets = null;
+ }
},
/**
More information about the Commits
mailing list