fixing scroll position issue on the IPhone by only clearing the mouse cache conditionally. r=erilem (closes #3132)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11706 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -854,7 +854,18 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
clearMouseCache: function() {
|
clearMouseCache: function() {
|
||||||
this.element.scrolls = null;
|
this.element.scrolls = null;
|
||||||
this.element.lefttop = 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;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user