From 807449046b6f68db7e7c8c127b2fdee618af520b Mon Sep 17 00:00:00 2001 From: crschmidt Date: Wed, 29 Aug 2007 04:03:13 +0000 Subject: [PATCH] Commit fix for an off-by-two error on standards complaint HTML pages in IE, and add an HTML example that can be used as an acceptance test. (Closes #863) Thanks pierre for the research and report! git-svn-id: http://svn.openlayers.org/trunk/openlayers@4098 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- examples/mouse-position.html | 43 ++++++++++++++++++++++++++++++++++++ lib/OpenLayers/Events.js | 6 +++-- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 examples/mouse-position.html diff --git a/examples/mouse-position.html b/examples/mouse-position.html new file mode 100644 index 0000000000..aa5827265f --- /dev/null +++ b/examples/mouse-position.html @@ -0,0 +1,43 @@ + + + + + + + + +
+
+

Moving your mouse to the upper left corner of this map should return 'x=0,y=0' -- in the past, it didn't in IE. If it returns 2,2, consider it a bug, and report it.

+ + diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index 11be2c5e0b..21d4dbc3d9 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -656,9 +656,11 @@ OpenLayers.Events = OpenLayers.Class({ } return new OpenLayers.Pixel( (evt.clientX + (document.documentElement.scrollLeft - || document.body.scrollLeft)) - this.element.offsets[0], + || document.body.scrollLeft)) - this.element.offsets[0] + - (document.documentElement.clientLeft || 0), (evt.clientY + (document.documentElement.scrollTop - || document.body.scrollTop)) - this.element.offsets[1] + || document.body.scrollTop)) - this.element.offsets[1] + - (document.documentElement.clientTop || 0) ); },