As told in the #817 [5] ticket, I found something interesting about the "IE doesn't draw vector elements where the user clicks" problem.
From what I understand, in some cases [1] IE’s clientX and clientY measurements are sometimes a couple pixels out.
It seems that for some reason, IE start from (2,2) to measure clientX and clientY.
It involves that the OpenLayers.Events.getMousePosition(evt) returns a response with a (2,2) pixels offset. Then the computed coordinates are somewhat invalid.
Man can reproduce this by trying to show the -180 longitude in the mousePosition in the controls.html examples under IE at zoomLevel = 1. The value always can't go lower than 177.89....
Following the [1] example of code given to get the mouse position [1], I managed to get the mouse-position.html [2] pixel coordinates starting at (0,0) by modifying a bit the getMousePosition() method [3].
But, despite what Beau [1] explains, this does only work in standard mode. In quirksmode [4], clientLeft and clientTop are both still equal to 0.
Hope this is clear enough. Don't hesitate to rewrite this in a more readable english.
- http://hartshorne.ca/2006/01/23/javascript_cursor_position/
- see attachment : mouse-position.html
- see attachment : patch.diff
- for those who don't know nothing about quirksmode, standard compliant mode, etc... please have a look at http://www.quirksmode.org/css/quirksmode.html and http://hsivonen.iki.fi/doctype/
- http://trac.openlayers.org/ticket/817